def ntp_time_to_date(ntp_time):
    year = 1900
ytab = [[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], [31, 29, 31, 30, 
    31, 30, 31, 31, 30, 31, 30, 31]]
dayno, dayclock = divmod(ntp_time, 86400)
dayno = int(dayno)
hour, sec_past_hour = divmod(dayclock, 3600)
hour = int(hour)
min, sec = divmod(int(sec_past_hour), 60)
while dayno >= year_size(year):
    dayno = dayno - year_size(year)
year = year + 1
month = 1
while dayno >= ytab[is_leap_year(year)][month]:
    dayno = dayno - ytab[is_leap_year(year)][month]
month = month + 1
day = dayno + 1
return year, month, day, hour, min, sec
Epoch Seconds to Date Conversion on a Limited Embedded Device