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