mirror of
https://git.checksum.fail/alec/slon.git
synced 2025-12-08 12:09:55 +02:00
System/Utilities/Time: Update for DST
This commit is contained in:
@@ -63,22 +63,40 @@ U0 @time_update(U8* date_str, I64 mS_delta, I64 hour_offset)
|
|||||||
@time_cmos_update_byte(0x00, second);
|
@time_cmos_update_byte(0x00, second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool @is_dst(I64 month, I64 day, I64 day_of_week, I64 hour)
|
||||||
|
{
|
||||||
|
if (month < 3 || month > 11) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (month > 3 && month < 11) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
if (month == 3) {
|
||||||
|
if (day < (14 - day_of_week)) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (day > (14 - day_of_week) && hour >= 2) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (month == 11) {
|
||||||
|
if (day < (7 - day_of_week)) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
if (day == (7 - day_of_week) && hour < 1) {
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
Bool @time_in_dst()
|
Bool @time_in_dst()
|
||||||
{
|
{
|
||||||
CDateStruct ds;
|
CDateStruct ds;
|
||||||
Date2Struct(&ds, Now);
|
Date2Struct(&ds, Now);
|
||||||
if (ds.mon > 3 && ds.mon < 11)
|
return @is_dst(ds.mon, ds.day_of_mon, ds.day_of_week, ds.hour);
|
||||||
return TRUE;
|
|
||||||
if (ds.mon < 3 || ds.mon > 11)
|
|
||||||
return FALSE;
|
|
||||||
if (ds.mon == 3 && ds.day_of_mon != 8)
|
|
||||||
return ds.day_of_mon > 8;
|
|
||||||
if (ds.mon == 3)
|
|
||||||
return ds.hour > 1;
|
|
||||||
if (ds.mon == 11 && ds.day_of_mon != 1)
|
|
||||||
return FALSE;
|
|
||||||
if (ds.mon == 11)
|
|
||||||
return ds.hour < 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 @time_tz_offset()
|
I64 @time_tz_offset()
|
||||||
|
|||||||
Reference in New Issue
Block a user