I need to write a program to generate a version 1 UUID. I am using the ftime() function to read the total seconds elapsed since 1-Jan-1970, in UTC timezone. With some other calculation, i am able to generate a time-based UUID. However, when I use an online program to retrieve time from the UUID string generated from my program, I get the time which is few hours more than the actual time.
For example, the timezone at my place is GMT+8:00.
I generate the UUID of 0012d6e0-36fe-11dc-1f41-12df23df56cd at the local time of "Fri Jul 20 16:15:47 2007", which is equivalent to "Fri Jul 20 08:15:47 2007" in UTC or GMT.
By using the program to retrieve timestamp from the UUID above, it displays the information as below:-
The uuid 0012d6e0-36fe-11dc-1f41-12df23df56cd contains the following timestamp:
Fri, 20 Jul 2007 20:15:46 +0000
I was wondering what could it be going wrong while interpreting the parameters return from the ftime() function? Is it related to timezone problem? How can I solve it?