Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Convert FIT_DATE_TIME

Rank

Total Posts: 1

Joined 0

PM

Hi all,

Is there any tool to convert from FIT_DATE_TIME to an "understandable" time?

Thanks      
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

I'm not sure which "tool" you expect.
Here's some simple C# code:

// fit_profile.hpp: "seconds since UTC 00:00 Dec 31 1989"
private static DateTime RefDateTime = new DateTime(1989, 12, 31, 0, 0, 0, DateTimeKind.Utc);
protected static DateTime ToDateTime(UInt32 dateTimeValue)
{
if (dateTimeValue != FIT_UINT32_INVALID)
return RefDateTime.AddSeconds(dateTimeValue);
else
return DateTime.MinValue;
}

Note that this omits the case "if date_time is < 0x10000000 then it is system time (seconds from device power on)".

Cheers,
OMB