2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
25 fn timezone_init(d : dhandle, env : treemap(bytes, bytes)) : timezone;
26 fn timezone_gmt : timezone;
41 fn time_to_calendar(tz : timezone, t : int64) : calendar;
42 fn calendar_to_time(tz : timezone, c : calendar) : int64;
50 fn timezone_init(d : dhandle, env : treemap(bytes, bytes)) : timezone := timezone.[ local : true ];
51 fn timezone_gmt : timezone := timezone.[ local : false ];
53 fn time_to_calendar(tz : timezone, t : int64) : calendar
55 var local := tz.local;
56 var year month day hour min sec usec yday wday is_dst : int;
57 pcode IO IO_TimeToCalendar 10 2 0 =year =month =day =hour =min =sec =usec =yday =wday =is_dst t local;
72 fn calendar_to_time(tz : timezone, c : calendar) : int64
74 var local := tz.local;
82 var is_dst := c.is_dst;
84 pcode IO IO_CalendarToTime 1 9 0 =r year month day hour min sec usec is_dst local;