1.UTC Time and GMT time
We can think of GMT as time Coordination Time (GMT=UTC), GMT and UTC time are calculated in seconds.
2.UTC Time and Local
UTC + time Zone difference = local time
Time zone Chadong is positive, West is negative. Here, the East eight zone time zone is +0800,
UTC + (+0800) = local (Beijing) time (1)
So, UTC = local time (Beijing time))-0800 (2)
3.UTC and Unix Timestamp
The UTC time that you see in your computer is calculated from (January 01, 1970 0:00:00) to the number of seconds. The UTC time that you see is the number of seconds from the 1970 point of time to the exact time. The second number is the Unix timestamp.
4. How to determine whether the program gets the UTC time or the local time
Let the program get a timestamp first, and then change the system's time zone settings. Then rerun the program, obtaining a timestamp, comparing the difference of two timestamps if it is small (should be less than half an hour, or 180 seconds), then the UTC time is obtained because this time is not related to your system time zone settings.
Take the C language as an example:
#include
#include
#include
void Main (void)
{
time_t start;
Time (&start);
printf ("%d\n", start);
while (1);
}
From:http://blog.sina.com.cn/s/blog_40a27f6a01016qd5.html