Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Oct 2006 11:39:37 -0700
From:      Chuck Swiger <cswiger@mac.com>
To:        Martin McCormick <martin@dc.cis.okstate.edu>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: A Question of How to Handle Numerical Notation
Message-ID:  <C22D4144-772A-47EB-93AA-7284F4C2B10D@mac.com>
In-Reply-To: <200610061821.k96ILWHA008725@dc.cis.okstate.edu>
References:  <200610061821.k96ILWHA008725@dc.cis.okstate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C22D4144-772A-47EB-93AA-7284F4C2B10D>