Search code examples
linuxposix

Is clock_gettime a UTC time, or local time zone?


Does the function clock_gettime return a timestamp measured from the epoch in UTC or in the local time zone?

I know that time is supposed to be from the UTC epoch, but I can't find any reference saying the same is true of clock_gettime.


Solution

  • To quote Wikipedia, the Unix Epoch is defined as

    the time 00:00:00 UTC on 1 January 1970 (or 1970-01-01T00:00:00Z ISO 8601).

    From this it follows that any reference to "the Epoch" implies UTC.