How does the time function know the current time of the PC? Does it use the Internet to sync with a time server as the computers do?

109 views Asked by At

How does the time function know the current time of the PC? I know how computers know the time. But how does the C++ time function implemented? Does it use the Internet to sync with a time server as the computers do? Or does it use the internal clock of the computer?

2

There are 2 answers

0
Luchik3333333 On BEST ANSWER

The function returns the current calendar time, which the program got by asking the computer what the current time is.

The function doesn't require internet, just your computer's internal clock :)

If you want to learn more on this topic, I highly recommend reading
Programiz's C-Time.

0
Veer-Khatri On

C++ asks your device(computer) about the time details and it doesn't require the internet you can check it by disconnecting your device's internet and then running the function