A Question of How to Handle Numerical Notation

Chuck Swiger cswiger at mac.com
Fri Oct 6 11:44:31 PDT 2006


On Oct 6, 2006, at 11:21 AM, Martin McCormick wrote:
> 	My thanks to you and to one other individual who have
> written responses to my questions.

You're welcome.

> 	I will talk to the people who extracted the file and see
> if there is a possibility we got the wrong data in that field.
> One would hope that the time stamp data are normal 32-bit values
> that can be sucked in by a %lx in sscanf.

No, they aren't, but there is sample code at the end of RFC-4122  
which you might want to review.  In particular:

typedef unsigned64_t uuid_time_t;

void get_system_time(uuid_time_t *uuid_time)
{
     struct timeval tp;

     gettimeofday(&tp, (struct timezone *)0);

     /* Offset between UUID formatted times and Unix formatted times.
        UUID UTC base time is October 15, 1582.
        Unix base time is January 1, 1970.*/
     *uuid_time = ((unsigned64)tp.tv_sec * 10000000)
         + ((unsigned64)tp.tv_usec * 10)
         + I64(0x01B21DD213814000);
}

-- 
-Chuck



More information about the freebsd-questions mailing list