c++current-time

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?


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?


Solution

  • 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.