diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-08-25 06:02:00 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-08-25 06:02:00 -0700 |
commit | e9f0db2c472e4a88a2a250caf559b3100c86fe67 (patch) | |
tree | 21a7bdcf7485b9ab8bbafe65078b503191929d83 /txr.1 | |
parent | c6fce0478a206a84f678e63ec242047f02ba8547 (diff) | |
download | txr-e9f0db2c472e4a88a2a250caf559b3100c86fe67.tar.gz txr-e9f0db2c472e4a88a2a250caf559b3100c86fe67.tar.bz2 txr-e9f0db2c472e4a88a2a250caf559b3100c86fe67.zip |
Adding time-parse method.
* lib.c (time_parse_s): New symbol variable.
(tm_to_time_struct): New static function,
based on code moved out of broken_time_struct.
(broken_time_struct): Bulk of code replaced with call to
tm_to_time_struct.
(time_struct_to_tm): New parameter, strict. Indicates
whether nils in time struct are converted to zeros,
or whether they trigger errors.
(time_string_meth): Specify strict conversion
of argument time struct to to struct tm when
calling time_struct_to_tm.
(time_parse_meth): New static function.
(time_init): Initialize time_parse_s symbol variable;
add time-parse static slot to time struct;
initialize slot with new method.
* txr.1: Document time-parse method.
Diffstat (limited to 'txr.1')
-rw-r--r-- | txr.1 | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -36601,6 +36601,57 @@ argument is a string, and follows exactly the same conventions as the format string of the C library function .codn strftime . +.coNP Method @ time-parse +.synb +.mets << time-struct .(time-parse < format << string ) +.syne +.desc +The +.code time-parse +method scans a time description in +.meta string +according to the specification given in the +.meta format +string. + +If the scan is successful, the structure +is updated with the parsed information, and +the remaining unmatched portion of +.meta string +is returned. If all of +.meta string +is matched, then an empty string is returned. +Slots of +.meta time-struct +which are originally +.code nil +are replaced with zero, even if these +zero values are not actually parsed from +.metn string . + +If the scan is unsuccessful, then +.code nil +is returned and the structure is not +altered. + +The +.meta format +argument follows the same conventions as the POSIX +C library function +.codn strptime . + +Note: the +.code time-parse +method may be unavailable if the host system does not +provide the +.code strptime +function. In this case, the +.code time-parse +static slot of the +.code time +struct is +.codn nil . + .coNP Functions @ make-time and @ make-time-utc .synb .mets (make-time < year < month < day < hour < minute < second << dst-advice ) |