Ok, I got it working.
From 40 bits, 16 msb bits represents MJD. Remaining 24 bits represent time in BCD coded as HHMMSS
.
For example 0xC079
in question represents MJD, that is 49273
in decimal.
To convert MJD to date, convert MJD in decimal (above converted to 49273), then:
To find Y, M, D from MJD:
Y' = int [(MJD - 15078.2) / 365.25]
M' = int { [MJD - 14956.1 - int (Y' * 365.25) ] / 30.6001 }
D = MJD - 14956 - int (Y' * 365.25) - int (M' * 30.6001 )
If M' = 14 or M' = 15, then K = 1; else K = 0
Y = Y' + K
M = M' - 1 - K * 12
Where
MJD
Modified Julian Date
Y
Year from 1900 (e.g. for 2003, Y = 103)
M
Month from January (= 1) to December (= 12)
D
Day of month from 1 to 31
K
,M'
, Y'
Intermediate variables
*
Multiplication
int
Integer part, ignoring remainder