Are struct stat times GMT?

One of the fields in the struct stat is st_mtime. I guess these are seconds since January 1, 1970. Is it GMT or local time?

+4
source share
1 answer

The time_t type represents the number of seconds elapsed since January 1, 1970, 00:00 UTC (this moment in time is called the β€œepoch” and occurred at that moment all over the world). You can assume that β€œUTC” means the same as β€œGMT” (see Leap Second for details on very small differences).

Remember that instead of adding or subtracting values ​​from the time_t type, you should always use the localtime() and mktime() functions to convert to and from the local time zone representation.

+8
source

All Articles