-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtime.id
92 lines (67 loc) · 3.21 KB
/
time.id
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# An opaque type that represent a time zone rule.
type sunrise_libuser::time::TimeZoneRule = bytes<0x4000>;
# Represent a time zone location name
type sunrise_libuser::time::LocationName = bytes<0x24>;
# Represent a POSIX Timestamp
type sunrise_libuser::time::PosixTime = i64;
# Represent the basic informations of a local time.
type sunrise_libuser::time::CalendarTime = struct<0x8> {
# The year of the local time
i16 year;
# The month of the local time
i8 month;
# The day of the local time
i8 day;
# The hour of the local time
i8 hour;
# The minute of the local time
i8 minute;
# The second of the local time
i8 second;
};
# Represent aditional info of a local time
type sunrise_libuser::time::CalendarAdditionalInfo = struct<0x18> {
# The day of the week of the local time
u32 day_of_week;
# The day of the year of the local time
u32 day_of_year;
# The name of the timezone of the local time
bytes<8> tz_name;
# True if the local time represent a Day Saving Time
bool is_daylight_saving_time;
# The GMT offset of the timezone used to generate this local time
i32 gmt_offset;
};
# Entry point interface
interface sunrise_libuser::time::StaticService is time:u, time:a, time:s {
# Get the TimeZone service object
[3] get_timezone_service() -> object<sunrise_libuser::time::TimeZoneService>;
}
# RTC interface
interface sunrise_libuser::time::RTCManager is rtc {
# Get the current RTC time
[1] get_rtc_time() -> sunrise_libuser::time::PosixTime;
# Event triggered on RTC time update
[3] get_rtc_event() -> handle<copy>;
}
# TimeZone service object
interface sunrise_libuser::time::TimeZoneService {
# Get the time zone name used on this devie
[0] get_device_location_name() -> sunrise_libuser::time::LocationName;
# Set the time zone name used on this devie
[1] set_device_location_name(sunrise_libuser::time::LocationName);
# Get the total count of location name available
[2] get_total_location_name_count() -> u32;
# Load the list of location name available
[3] load_location_name_list(u32) -> (u32, array<sunrise_libuser::time::LocationName, 0x6>);
# Load a time zone rule
[4] load_timezone_rule(sunrise_libuser::time::LocationName) -> buffer<sunrise_libuser::time::TimeZoneRule, 0x16, 0x4000>;
# Convert a PosixTime to a local time using a TimeZoneRule
[100] to_calendar_time(sunrise_libuser::time::PosixTime, buffer<sunrise_libuser::time::TimeZoneRule, 0x15, 0x4000>) -> (sunrise_libuser::time::CalendarTime, sunrise_libuser::time::CalendarAdditionalInfo);
# Convert a PosixTime to a local time using the device TimeZoneRule
[101] to_calendar_time_with_my_rule(sunrise_libuser::time::PosixTime) -> (sunrise_libuser::time::CalendarTime, sunrise_libuser::time::CalendarAdditionalInfo);
# Convert a local time to a PosixTime using a TimeZoneRule.
[4201] to_posix_time(sunrise_libuser::time::CalendarTime, buffer<sunrise_libuser::time::TimeZoneRule, 0x15, 0x4000>) -> sunrise_libuser::time::PosixTime;
# Convert a local time to a PosixTime using the device TimeZoneRule
[4202] to_posix_time_with_my_rule(sunrise_libuser::time::CalendarTime) -> sunrise_libuser::time::PosixTime;
}