Reputation: 15
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?
Upvotes: 0
Views: 143
Reputation: 76
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.
Upvotes: 1
Reputation: 35
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
Upvotes: 1