Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Fit Timestamp Conversion

Rank

Total Posts: 3

Joined 2012-12-19

PM

Hi, complete newbie question here could someone explain how I should convert a timestamp into a Time. I'm guessing that I need to add the value, eg 705738584 (secs?) to a reference time.

I'm not dealing with a compressed timestamp as the record header doesn't indicate it.

I've tried reviewing the docs but must be missing this.

Thanks in advance,

Adam

     
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

Here's the code snippet from my software:

// fit_profile.hpp: "seconds since UTC 00:00 Dec 31 1989"
private static readonly DateTime RefDateTime = new DateTime(19891231000DateTimeKind.Utc);
protected static 
Nullable<DateTimeToDateTime(UInt32 dateTimeValue)
{
    
if (dateTimeValue != FIT_UINT32_INVALID)
        return 
RefDateTime.AddSeconds(dateTimeValue);
    else
        return 
null;


     
Rank

Total Posts: 3

Joined 2012-12-19

PM

Awesome, thanks.

Intrigued as to why 00:00 Dec 31 1989 is the reference time, do you know it's significance?

     
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

Afaik, it's the birthdate of the Dynastream CEO's first cat wink

Seriosly: they HAVE to assume a certain base date. Unix has Jan 1, 1970, Excel Dec 12, 1899 and there are lots of others for sure.      
Rank

Total Posts: 3

Joined 2012-12-19

PM

smile understand the need for it, just wondered why. Thanks for your help      
Avatar
RankRankRankRank

Total Posts: 662

Joined 2012-10-09

PM

old_man_biking - 19 December 2012 07:36 AM
Afaik, it's the birthdate of the Dynastream CEO's first cat ;-)



Meet Silver ;)


     

Image Attachments

silver_and_the_xmas_tree.jpg

Click thumbnail to see full-size image

RankRankRank

Total Posts: 91

Joined 2012-10-12

PM

-Profile.xls (found in the SDK archive) is the place to go for details about the types and messages derived from the base types described in the protocol doc.