23 |
* Time of Day:: Getting the current time. |
* Time of Day:: Getting the current time. |
24 |
* Time Conversion:: Converting a time from numeric form to a string, or |
* Time Conversion:: Converting a time from numeric form to a string, or |
25 |
to calendrical data (or vice versa). |
to calendrical data (or vice versa). |
26 |
|
* Time Calculations:: Adding, subtracting, comparing times, etc. |
27 |
* Timers:: Setting a timer to call a function at a certain time. |
* Timers:: Setting a timer to call a function at a certain time. |
28 |
* Terminal Input:: Recording terminal input for debugging. |
* Terminal Input:: Recording terminal input for debugging. |
29 |
* Terminal Output:: Recording terminal output for debugging. |
* Terminal Output:: Recording terminal output for debugging. |
1033 |
traditional Gregorian years do; for example, the year number @minus{}37 |
traditional Gregorian years do; for example, the year number @minus{}37 |
1034 |
represents the Gregorian year 38 B.C@. |
represents the Gregorian year 38 B.C@. |
1035 |
|
|
1036 |
|
@defun date-to-time string |
1037 |
|
This function parses the time-string @var{string} and returns the |
1038 |
|
corresponding time value. |
1039 |
|
@end defun |
1040 |
|
|
1041 |
@defun format-time-string format-string &optional time universal |
@defun format-time-string format-string &optional time universal |
1042 |
This function converts @var{time} (or the current time, if @var{time} is |
This function converts @var{time} (or the current time, if @var{time} is |
1043 |
omitted) to a string according to @var{format-string}. The argument |
omitted) to a string according to @var{format-string}. The argument |
1152 |
string using that same coding system. |
string using that same coding system. |
1153 |
@end defun |
@end defun |
1154 |
|
|
1155 |
|
@defun seconds-to-time seconds |
1156 |
|
This function converts @var{seconds}, a floating point number of |
1157 |
|
seconds since the epoch, to a time value and returns that. To perform |
1158 |
|
the inverse conversion, use @code{float-time}. |
1159 |
|
@end defun |
1160 |
|
|
1161 |
@defun decode-time time |
@defun decode-time time |
1162 |
This function converts a time value into calendrical information. The |
This function converts a time value into calendrical information. The |
1163 |
return value is a list of nine elements, as follows: |
return value is a list of nine elements, as follows: |
1229 |
if you try to encode a time that is out of range, an error results. |
if you try to encode a time that is out of range, an error results. |
1230 |
@end defun |
@end defun |
1231 |
|
|
1232 |
|
@node Time Calculations |
1233 |
|
@section Time Calculations |
1234 |
|
|
1235 |
|
These functions perform calendrical computations using time values |
1236 |
|
(the kind of list that @code{current-time} returns). |
1237 |
|
|
1238 |
|
@defun time-less-p t1 t2 |
1239 |
|
This returns @code{t} if time value @var{t1} is less than time value |
1240 |
|
@var{t2}. |
1241 |
|
@end defun |
1242 |
|
|
1243 |
|
@defun time-subtract t1 t2 |
1244 |
|
This returns the time difference @var{t1} @minus{} @var{t2} between |
1245 |
|
two time values, in the same format as a time value. |
1246 |
|
@end defun |
1247 |
|
|
1248 |
|
@defun time-add t1 t2 |
1249 |
|
This returns the sum of two time values, one of which ought to |
1250 |
|
represent a time difference rather than a point in time. |
1251 |
|
Here is how to add a number of seconds to a time value: |
1252 |
|
|
1253 |
|
@example |
1254 |
|
(time-add @var{time} (seconds-to-time @var{seconds})) |
1255 |
|
@end example |
1256 |
|
@end defun |
1257 |
|
|
1258 |
|
@defun time-to-days time |
1259 |
|
This function returns the number of days between the beginning of year |
1260 |
|
1 and @var{time}. |
1261 |
|
@end defun |
1262 |
|
|
1263 |
|
@defun time-to-day-in-year time |
1264 |
|
This returns the day number within the year corresponding to @var{time}. |
1265 |
|
@end defun |
1266 |
|
|
1267 |
|
@defun date-leap-year-p year |
1268 |
|
This function returns @code{t} if @var{year} is a leap year. |
1269 |
|
@end defun |
1270 |
|
|
1271 |
@node Timers |
@node Timers |
1272 |
@section Timers for Delayed Execution |
@section Timers for Delayed Execution |
1273 |
@cindex timer |
@cindex timer |