Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > timestamp question

Reply
Thread Tools

timestamp question

 
 
wongjoekmeu@yahoo.com
Guest
Posts: n/a
 
      05-19-2008
Hello all,

I have a C++ program ( I am not sure if this is the right place to
post this question ), One of the function returns two unsigned
integers which are referred to be TimestampLo and TimestampHi. Can
anyone please help me out how I am supposed to convert these two
integer to an understandable timestamp. It says also for the
TimestampLo variable that this is the lower 32-bits and for the
TimestampHi variable is the higher 32-bits. What does that mean ? And
how do I construct the timestamp ? Thanks. If this is not the right
place to post this question can anyone please give me some suggestion
where I could post this ?

rr
 
Reply With Quote
 
 
 
 
Erik Wikström
Guest
Posts: n/a
 
      05-19-2008
On 2008-05-19 20:54, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hello all,
>
> I have a C++ program ( I am not sure if this is the right place to
> post this question ), One of the function returns two unsigned
> integers which are referred to be TimestampLo and TimestampHi. Can
> anyone please help me out how I am supposed to convert these two
> integer to an understandable timestamp. It says also for the
> TimestampLo variable that this is the lower 32-bits and for the
> TimestampHi variable is the higher 32-bits. What does that mean ?


It means that the two integers are the two halves of one big (64-bit)
integer. TimestampLo contains bits 0-31 or the timestamp and TimestampHi
contains bits 32-63

> And how do I construct the timestamp ?


Put them back into a 64-bit integer (probably a long or a long long on
your platform, if you can use the uint64_t type to be sure). You can use
shifting and binary or to create the original timestamp like this:

uint64_t ts = TimestampHi;
ts = ts << 32;
ts = ts | TimestampLo;

Make sure that the 64-bit variable is unsigned.

--
Erik Wikström
 
Reply With Quote
 
 
 
 
James Kanze
Guest
Posts: n/a
 
      05-20-2008
On May 19, 9:21 pm, Erik Wikstrm <(E-Mail Removed)> wrote:
> On 2008-05-19 20:54, (E-Mail Removed) wrote:
> > I have a C++ program ( I am not sure if this is the right
> > place to post this question ), One of the function returns
> > two unsigned integers which are referred to be TimestampLo
> > and TimestampHi. Can anyone please help me out how I am
> > supposed to convert these two integer to an understandable
> > timestamp. It says also for the TimestampLo variable that
> > this is the lower 32-bits and for the TimestampHi variable
> > is the higher 32-bits. What does that mean ?


> It means that the two integers are the two halves of one big
> (64-bit) integer. TimestampLo contains bits 0-31 or the
> timestamp and TimestampHi contains bits 32-63


> > And how do I construct the timestamp ?


> Put them back into a 64-bit integer (probably a long or a long
> long on your platform, if you can use the uint64_t type to be
> sure). You can use shifting and binary or to create the
> original timestamp like this:


> uint64_t ts = TimestampHi;
> ts = ts << 32;
> ts = ts | TimestampLo;


> Make sure that the 64-bit variable is unsigned.


Which still only gives you an integral value. What that
integral value means depends on the system, and he really needs
to look at the system documentation for that. (In this case,
the system also contains various functions for manipulating or
converting the original format. The only reason I can think of
for converting to uint64_t is to convert it to a standard
time_t, in which case, you'll have to follow up with a few
additional steps.)

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique oriente objet/
Beratung in objektorientierter Datenverarbeitung
9 place Smard, 78210 St.-Cyr-l'cole, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ObjectDataSource, Opportunistic Concurrency, Typed Dataset and timestamp field question J055 ASP .Net 1 08-08-2006 11:33 AM
question about timestamp and MySQLdb Sean Berry Python 3 10-21-2005 03:05 AM
Convert to NTP Timestamp Manzoorul Hassan Perl 1 03-11-2005 05:37 PM
PIX logging without timestamp Ste Cisco 2 09-04-2004 01:08 AM
log timestamp format Bill F Cisco 3 07-24-2003 05:40 AM



Advertisments