Jump to content

# How to Calculate HEX time string to Normal Time string (SYSTEM)

## Recommended Posts

Hi All,

I want to decode a HEX time into System time and need a conversion factor for the same.

The HEX time stamp is : 0F2E3B2D

The approx system time is : 12:29:44.419 PM

Thanks

Pravin

##### Link to post

More information is needed.  What is the units of the HEX time stamp?  Is it seconds?  Milliseconds? Minutes? Hours? Days?  And what is the date of your time?  Are you saying that the hex value starts 0 at midnight?  and by just after noon you have over 254 million units of time?

A pretty quick and dirty way of making this work is to find the difference between the hex input, and the known input you have there, then add or subtract that amount of time from the known time stamp you have there.

##### Link to post

And I thought Internet Time was the coolest thing...

@139.beats

Edited by ThomasGutzler
##### Link to post

The HEX time is in milliseconds and the day of my time was 4 sept 2014.

This is actually a responce from a controller and if i subtract two values i get difference in milliseconds.

Hope it will be usefull

regards

Pravin

##### Link to post

The HEX time is in milliseconds and the day of my time was 4 sept 2014.

This is actually a responce from a controller and if i subtract two values i get difference in milliseconds.

Milliseconds relative to what?

• Relative to the time when the controller started running?
• Relative to midnight of 1 January 1970?
• Something else?

0x0F2E3B2D is 254688045 in decimal. 254688045 milliseconds is about 8.8 hours.

Had your controller been running for 8.8 hours when you captured that timestamp?

##### Link to post

The HEX time is in milliseconds and the day of my time was 4 sept 2014.

This is actually a responce from a controller and if i subtract two values i get difference in milliseconds.

Hope it will be usefull

regards

Pravin

Your Hex time is a so called timer tick time. Its counter starts at boot up of the system (or any other time your embedded system likes) and simply counts through, wrapping around after 0xFFFFFFFF (or 2^32 = ~4 billion) ms = ~ 4 million seconds = ~50 days. As such there is absolutely no good way to convert this into an absolute timestamp since its reference time (the 0 point) will be defined new every 50 days or so, or whenever you startup/reset your system.

Your value indicates that your system was probably up and running for around 254688 seconds = ~3 days since last booted/reset.

0x0F2E3B2D is 254688045 in decimal. 254688045 milliseconds is about 8.8 hours.

A day has 86400 seconds, so 254688 seconds certainly is more than 8.8 hours.

##### Link to post

A day has 86400 seconds, so 254688 seconds certainly is more than 8.8 hours.

Oops, I misread Wolfram Alpha. You're right, 254688 seconds is almost 3 days.

##### Link to post

Oops, I misread Wolfram Alpha. You're right, 254688 seconds is almost 3 days.

I see! You let your embedded devices have a normal 8 hour working day and interpret the number of working days as hours!

##### Link to post

I see! You let your embedded devices have a normal 8 hour working day and interpret the number of working days as hours!

So that they don't burn out from overwork, and so that I can pay less wages

P.S. For humans, I endorse the former, not the latter

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• #### Activity

• Downloads
• Wiki
×
• Create New...

## Important Information

By using this site, you agree to our Terms of Use.