Code : Tout sélectionner
; DWORD JulianToGregorian(DWORD Yj, DWORD Mj, DWORD Dj, DWORD* Yg, DWORD* Mg, DWORD* Dg)
;
; This function converts the Julian date to the adequate Gregorian date.
;
; Parameters:
; Yj - year of the Julian date,
; Mj - month of the Julian date,
; Dj - day of the Julian date,
; Yg - pointer to variable where the calculated year number of the Gregorian date will be stored,
; Mg - pointer to variable where the calculated month number of the Gregorian date will be stored,
; Dg - pointer to variable where the calculated day number of the Gregorian date will be stored.
;
; Returned values:
; * 0 for the valid Julian date,
; * -1 in opposite case.
;
Procedure.l JulianToGregorian( Yj.l, Mj.l, Dj.l, Yg.l, Mg.l, Dg.l)
Protected tmpeax.l
EnableASM
juliantonum:
DateToAbsDayNum( Yj, Mj, Dj, 0)
MOV tmpeax, eax
TEST eax, eax
JZ l_juliantogregorian_error
numtogregorian:
AbsDayNumToDate( tmpeax, 1, Yg, Mg, Dg)
JMP l_juliantogregorian_theend
error:
MOV eax, -1
theend:
DisableASM
ProcedureReturn
EndProcedure