Debian Codegraph @

gcc/m2/gm2-libs-iso/wrapclock.def

raw
1 (* wrapclock.def provides access to clock primitives.
2
3 Copyright (C) 2023-2025 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <[email protected]>.
5
6 This file is part of GNU Modula-2.
7
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
21
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
26
27 DEFINITION MODULE wrapclock ;
28
29 FROM SYSTEM IMPORT ADDRESS ;
30
31 TYPE
32 timespec = ADDRESS ;
33
34
35 (*
36 timezone - return the glibc timezone value.
37 This contains the difference between UTC and the latest
38 local standard time, in seconds west of UTC.
39 If the underlying timezone is unavailable and
40 clock_gettime, localtime_r, tm_gmtoff
41 is unavailable then 0 is returned.
42 *)
43
44 PROCEDURE timezone () : LONGINT ;
45
46
47 (*
48 istimezone returns 1 if timezone in wrapclock.cc can resolve the
49 timezone value using the timezone C library call or by using
50 clock_gettime, localtime_r and tm_gmtoff.
51 *)
52
53 PROCEDURE istimezone () : INTEGER ;
54
55
56 (*
57 daylight - return the glibc daylight value.
58 This variable has a nonzero value if Daylight Saving
59 Time rules apply.
60 A nonzero value does not necessarily mean that Daylight
61 Saving Time is now in effect; it means only that Daylight
62 Saving Time is sometimes in effect.
63 *)
64
65 PROCEDURE daylight () : INTEGER ;
66
67
68 (*
69 isdst - returns 1 if daylight saving time is currently in effect and
70 returns 0 if it is not.
71 *)
72
73 PROCEDURE isdst () : INTEGER ;
74
75
76 (*
77 tzname - returns the string associated with the local timezone.
78 The daylight value is 0 or 1. The value 0 returns the non
79 daylight saving timezone string and the value of 1 returns
80 the daylight saving timezone string.
81 *)
82
83 PROCEDURE tzname (daylight: INTEGER) : ADDRESS ;
84
85
86 (*
87 InitTimespec - returns a newly created opaque type.
88 *)
89
90 PROCEDURE InitTimespec () : timespec ;
91
92
93 (*
94 KillTimespec - deallocates the memory associated with an
95 opaque type.
96 *)
97
98 PROCEDURE KillTimespec (tv: timespec) : timespec ;
99
100
101 (*
102 GetTimespec - retrieves the number of seconds and nanoseconds
103 from the timespec. A return value of 0 means timespec
104 is unavailable and a return value of 1 indicates success.
105 *)
106
107 PROCEDURE GetTimespec (ts: timespec; VAR sec, nano: LONGCARD) : INTEGER ;
108
109
110 (*
111 SetTimespec - sets the number of seconds and nanoseconds
112 into timespec. A return value of 0 means timespec
113 is unavailable and a return value of 1 indicates success.
114 *)
115
116 PROCEDURE SetTimespec (ts: timespec; sec, nano: LONGCARD) : INTEGER ;
117
118
119 (*
120 GetTimeRealtime - performs return gettime (CLOCK_REALTIME, ts).
121 gettime returns 0 on success and -1 on failure.
122 If the underlying system does not have gettime
123 then GetTimeRealtime returns 1.
124 *)
125
126 PROCEDURE GetTimeRealtime (ts: timespec) : INTEGER ;
127
128
129 (*
130 SetTimeRealtime - performs return settime (CLOCK_REALTIME, ts).
131 gettime returns 0 on success and -1 on failure.
132 If the underlying system does not have gettime
133 then SetTimeRealtime returns 1.
134 *)
135
136 PROCEDURE SetTimeRealtime (ts: timespec) : INTEGER ;
137
138
139 END wrapclock.