1
+ #pragma safe
1
2
class Clock;
2
3
3
4
external classtype;
4
5
5
- use String : {string};
6
+ use String: { string };
6
7
7
8
export all;
8
9
9
-
10
10
external typedef time;
11
11
12
- objdef Clock TheClock = create_TheClock( );
12
+ objdef Clock TheClock = create_TheClock();
13
13
14
- external Clock create_TheClock( );
14
+ external Clock create_TheClock();
15
15
#pragma effect World::TheWorld
16
+ #pragma linkobj "src/Clock/clock.o"
16
17
#pragma linksign [0]
17
- #pragma linkobj "src/Clock/clock.o"
18
-
19
-
20
-
21
- /*
22
- * Functions for generating time values.
23
- */
18
+ /*
19
+ * Functions for generating time values.
20
+ */
24
21
25
- external time to_time( int secs);
22
+ external time to_time(int secs);
23
+ #pragma linkobj "src/Clock/to_time.o"
26
24
#pragma linkname "SACto_time"
27
- #pragma linkobj "src/Clock/to_time.o"
28
25
#pragma linksign [0,1]
29
- /*
30
- * Convert seconds since the Epoch into a time value
26
+ /*
27
+ * Convert seconds since the Epoch into a time value.
31
28
*/
32
29
33
30
external time gettime();
34
31
#pragma effect TheClock
32
+ #pragma linkobj "src/Clock/gettime.o"
35
33
#pragma linkname "SACgettime"
36
- #pragma linkobj "src/Clock/gettime.o"
37
34
#pragma linksign [0]
38
35
/* Get the current system time.
39
36
*
40
- * Note: Although the system clock of course is not effected by a call
41
- * to this function, the pragma effect is used instead of touch.
42
- * This is done to achieve a sequentialization which is necessary
43
- * since the state of the clock is not constant although it may
44
- * not be modified from within a SAC program.
37
+ * Note: Although the system clock of course is not effected by a call
38
+ * to this function, the pragma effect is used instead of touch.
39
+ * This is done to achieve a sequentialization which is necessary
40
+ * since the state of the clock is not constant although it may
41
+ * not be modified from within a SAC program.
45
42
*/
46
43
47
-
48
44
external time, bool mktime(int YEAR, int MON, int DAY, int HOUR, int MIN, int SEC);
45
+ #pragma linkobj "src/Clock/mktime.o"
49
46
#pragma linkname "SACmktime"
50
- #pragma linkobj "src/Clock/mktime.o"
51
47
#pragma linksign [0,1,2,3,4,5,6,7]
52
- /* Generate a time value for a given time. The boolean result informs
53
- * about success or failure (The given time may not be specified as
54
- * time value).
48
+ /*
49
+ * Generate a time value for a given time. The boolean result informs
50
+ * about success or failure (The given time may not be specified as
51
+ * time value).
55
52
*/
56
53
57
-
58
-
59
- /*
60
- * Functions for decomposing time values.
61
- */
62
-
54
+ /******************************************************************************
55
+ *
56
+ * Functions for decomposing time values.
57
+ *
58
+ ******************************************************************************/
63
59
64
60
external int sec(time T);
61
+ #pragma linkobj "src/Clock/extracttime.o"
65
62
#pragma linkname "SACsec"
66
- #pragma linkobj "src/Clock/extracttime.o"
67
63
#pragma linksign [0,1]
68
64
/*
69
65
* The number of seconds after the minute, normally in
@@ -72,146 +68,140 @@ external int sec(time T);
72
68
*/
73
69
74
70
external int min(time T);
71
+ #pragma linkobj "src/Clock/extracttime.o"
75
72
#pragma linkname "SACmin"
76
- #pragma linkobj "src/Clock/extracttime.o"
77
73
#pragma linksign [0,1]
78
74
/*
79
- * The number of minutes after the hour, in the range 0 to 59.
75
+ * The number of minutes after the hour, in the range 0 to 59.
80
76
*/
81
77
82
78
external int hour(time T);
79
+ #pragma linkobj "src/Clock/extracttime.o"
83
80
#pragma linkname "SAChour"
84
- #pragma linkobj "src/Clock/extracttime.o"
85
81
#pragma linksign [0,1]
86
82
/*
87
- * The number of hours past midnight, in the range 0 to 23.
83
+ * The number of hours past midnight, in the range 0 to 23.
88
84
*/
89
85
90
86
external int mday(time T);
87
+ #pragma linkobj "src/Clock/extracttime.o"
91
88
#pragma linkname "SACmday"
92
- #pragma linkobj "src/Clock/extracttime.o"
93
89
#pragma linksign [0,1]
94
90
/*
95
- * The day of the month, in the range 1 to 31.
91
+ * The day of the month, in the range 1 to 31.
96
92
*/
97
93
98
94
external int mon(time T);
95
+ #pragma linkobj "src/Clock/extracttime.o"
99
96
#pragma linkname "SACmon"
100
- #pragma linkobj "src/Clock/extracttime.o"
101
97
#pragma linksign [0,1]
102
98
/*
103
- * The number of months since January, in the range 0 to 11.
99
+ * The number of months since January, in the range 0 to 11.
104
100
*/
105
101
106
102
external int year(time T);
103
+ #pragma linkobj "src/Clock/extracttime.o"
107
104
#pragma linkname "SACyear"
108
- #pragma linkobj "src/Clock/extracttime.o"
109
105
#pragma linksign [0,1]
110
106
/*
111
- * The year, starting with 0=1900.
107
+ * The year, starting with 0=1900.
112
108
*/
113
109
114
110
external int wday(time T);
111
+ #pragma linkobj "src/Clock/extracttime.o"
115
112
#pragma linkname "SACwday"
116
- #pragma linkobj "src/Clock/extracttime.o"
117
113
#pragma linksign [0,1]
118
114
/*
119
- * The number of days since Sunday, in the range 0 to 6
115
+ * The number of days since Sunday, in the range 0 to 6
120
116
*/
121
-
117
+
122
118
external int yday(time T);
119
+ #pragma linkobj "src/Clock/extracttime.o"
123
120
#pragma linkname "SACyday"
124
- #pragma linkobj "src/Clock/extracttime.o"
125
121
#pragma linksign [0,1]
126
122
/*
127
- * The number of days since January 1, in the range 0 to 365.
123
+ * The number of days since January 1, in the range 0 to 365.
128
124
*/
129
125
130
126
external int, int, int clock(time T);
127
+ #pragma linkobj "src/Clock/date.o"
131
128
#pragma linkname "SACclock"
132
- #pragma linkobj "src/Clock/date.o"
133
129
#pragma linksign [0,1,2,3]
134
130
/*
135
- * Extract hours, minutes, and seconds from time value T.
131
+ * Extract hours, minutes, and seconds from time value T.
136
132
*/
137
133
138
134
external int, int, int date(time T);
135
+ #pragma linkobj "src/Clock/date.o"
139
136
#pragma linkname "SACdate"
140
- #pragma linkobj "src/Clock/date.o"
141
137
#pragma linksign [0,1,2,3]
142
138
/*
143
- * Extract year, month, and day from time value T.
139
+ * Extract year, month, and day from time value T.
144
140
*/
145
141
146
-
147
-
148
- /*
149
- * Functions for getting additional information about the time.
150
- */
151
-
142
+ /******************************************************************************
143
+ *
144
+ * Functions for getting additional information about the time.
145
+ *
146
+ ******************************************************************************/
152
147
153
148
external int isdst(time T);
149
+ #pragma linkobj "src/Clock/isdst.o"
154
150
#pragma linkname "SACisdst"
155
- #pragma linkobj "src/Clock/isdst.o"
156
151
#pragma linksign [0,1]
157
152
/*
158
- * A flag that indicates whether daylight saving time
159
- * is in effect at the time described. The value is
160
- * positive if daylight saving time is in effect, zero
161
- * if it is not, and negative if the information is
153
+ * A flag that indicates whether daylight saving time is in effect at
154
+ * the time described. The value is positive if daylight saving time
155
+ * is in effect, zero if it is not, and negative if the information is
162
156
* not available.
163
157
*/
164
158
165
159
external bool isleap(int YEAR);
160
+ #pragma linkobj "src/Clock/isleap.o"
166
161
#pragma linkname "SACisleap"
167
- #pragma linkobj "src/Clock/isleap.o"
168
162
#pragma linksign [0,1]
169
163
170
164
external bool isleap(time T);
165
+ #pragma linkobj "src/Clock/isleap.o"
171
166
#pragma linkname "SACisleapt"
172
- #pragma linkobj "src/Clock/isleap.o"
173
167
#pragma linksign [0,1]
174
168
/*
175
- * Test the given year YEAR or the time value T respectively
169
+ * Test the given year YEAR or the time value T respectively
176
170
* for being a leap year.
177
171
*/
178
172
179
173
external double difftime(time T1, time T0);
174
+ #pragma linkobj "src/Clock/difftime.o"
180
175
#pragma linkname "SACdifftime"
181
- #pragma linkobj "src/Clock/difftime.o"
182
176
#pragma linksign [0,1,2]
183
177
/*
184
- * This function returns the number of seconds
185
- * elapsed between time T1 and time T0.
178
+ * The number of seconds elapsed between time T1 and time T0.
186
179
*/
187
180
188
-
189
-
190
- /*
191
- * Functions for converting time values and string representations.
192
- */
193
-
181
+ /******************************************************************************
182
+ *
183
+ * Functions for converting time values and string representations.
184
+ *
185
+ ******************************************************************************/
194
186
195
187
external string ctime(time T);
188
+ #pragma linkobj "src/Clock/ctime.o"
196
189
#pragma linkname "SACctime"
197
- #pragma linkobj "src/Clock/ctime.o"
198
190
#pragma linksign [0,1]
199
191
/*
200
- * The ctime() function converts the time T into
201
- * a string of the form
202
- *
203
- * "Wed Jun 30 21:49:08 1993\n"
192
+ * The ctime() function converts the time T into a string of the form
193
+ * `Wed Jun 30 21:49:08 1993'
204
194
*
205
- * The abbreviations for the days of the week are `Sun',
206
- * `Mon', `Tue', `Wed', `Thu', `Fri', and `Sat'.
207
- * The abbreviations for the months are `Jan', `Feb', `Mar', `Apr',
208
- * `May', `Jun ', `Jul ', `Aug ', `Sep ', `Oct ', `Nov ', and `Dec'
209
- *
195
+ * The abbreviations for the days of the week are:
196
+ * `Mon', `Tue', `Wed', `Thu', `Fri', `Sat', and `Sun'.
197
+ * The abbreviations for the months are:
198
+ * `Jan ', `Feb ', `Mar ', `Apr ', `May ', `Jun ', `Jul',
199
+ * `Aug', `Sep', `Oct', `Nov', and `Dec'.
210
200
*/
211
201
212
202
external string strftime(int LEN, string FORMAT, time T);
203
+ #pragma linkobj "src/Clock/strftime.o"
213
204
#pragma linkname "SACstrftime"
214
- #pragma linkobj "src/Clock/strftime.o"
215
205
#pragma linksign [0,1,2,3]
216
206
/*
217
207
* Convert the time T into a string of maximum length LEN
@@ -220,9 +210,9 @@ external string strftime(int LEN, string FORMAT, time T);
220
210
* If an error occurs the returned string is empty.
221
211
*/
222
212
223
- external time, string strptime(string S, string FORMAT);
213
+ external time, string strptime(string S, string FORMAT);
214
+ #pragma linkobj "src/Clock/strptime.o"
224
215
#pragma linkname "SACstrptime"
225
- #pragma linkobj "src/Clock/strptime.o"
226
216
#pragma linksign [0,1,2,3]
227
217
/*
228
218
* Complementary function to strftime(),
@@ -235,14 +225,11 @@ external time, string strptime(string S, string FORMAT);
235
225
* and the returned time is 0.
236
226
*/
237
227
238
-
239
- external void sleep(int SECONDS);
228
+ external void sleep(int SECONDS);
240
229
#pragma effect World::TheWorld
230
+ #pragma linkobj "src/Clock/sleep.o"
241
231
#pragma linkname "SACsleep"
242
- #pragma linkobj "src/Clock/sleep.o"
243
232
#pragma linksign [1]
244
233
/*
245
234
* Make the calling thread sleep until SECONDS seconds have elapsed.
246
235
*/
247
-
248
-
0 commit comments