473,473 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

timestamp question

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
Jun 27 '08 #1
3 2067
On 2008-05-19 20:54, wo*********@yahoo.com 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
Jun 27 '08 #2
wo*********@yahoo.com 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 ? 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 ?
It would be better if you asked in the newsgroup that deals with the
part of the system to which the timestamp applies. Is that a file?
Then it's likely that your question is OS-specific. Is that the
compilation unit? Then the compiler newsgroup is the right place. Is
that an Internet connection? Then you probably need to talk to the
makers of the 3rd party library you're using for your Internet access
(it can of course be the compiler vendor or the OS vendor).

C++ has several time values (basically coming from the C Standard
Library) and I don't know of any that would have a two-part design.
There is 'time_t' type, there is 'tm' type. That's about it. And the
functions that return those are quite well known and described in every
FM you can R.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 27 '08 #3
On May 19, 9:21 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
On 2008-05-19 20:54, wongjoek...@yahoo.com 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:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lauren Quantrell | last post by:
Is there any reason at all to use a timestamp column in a table having a primarykey column??? lq
3
by: Sean Berry | last post by:
I am using MySQLdb to connect to a database and retrieve a timestamp from a table. The problem is I want the timestamp as a long, unformatted and all. In the table I have a timestamp like this...
2
by: jay | last post by:
hi, Question on Load/import command. consider a sample table create table table_name ( col1 timestamp not null default current timestamp, col2 int, col3 int, col4 int, primary key(col1) );...
2
by: Zygo Blaxell | last post by:
I have a table with a few million rows of temperature data keyed by timestamp. I want to group these rows by timestamp intervals (e.g. every 32 seconds), compute aggregate functions on the...
6
by: Jim C. Nasby | last post by:
Is there any reason why there isn't a predefined cast to go from a timestamp to a varchar? Is there a reason not to add one? -- Jim C. Nasby, Database Consultant jim@nasby.net...
4
by: mghale | last post by:
I have a question that I'm hoping has an easy answer. I'm working in DB2 V8.2 on AIX 5.3 I have a timestamp column (i.e. 4/26/2006 1:02:42.000000 PM) that I want to return in a report from...
7
by: JJ | last post by:
How do I set one field to have the updated timestamp, and another to have the created timestamp? I want to do this directly from code generated from DB Designer if possible?! JJ
5
by: Henry J. | last post by:
I know this could be a dumb question, I just want to confirm that it is faster to execute inserts, if a timestamp field is set to have a default value, like DEFAULT CURRENT TIMESTAMP, and skip that...
0
gregerly
by: gregerly | last post by:
Hello, I've got a question regarding the comparison of a date and year to a timestamp. I've got blog entries that get a timestamp on their way into my database (mysql). I'm programming an...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.