diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-10-31 19:38:03 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-10-31 19:38:03 -0700 |
commit | d40e8bd6d7956f757bffd34c7288fd996e617c1e (patch) | |
tree | 6ffc3dfa4cc992f8fcd19acc48f7a73de104ac13 /sysif.h | |
parent | 1d3d115e1f50d1f1feaec7d409c853621b8d939f (diff) | |
download | txr-d40e8bd6d7956f757bffd34c7288fd996e617c1e.tar.gz txr-d40e8bd6d7956f757bffd34c7288fd996e617c1e.tar.bz2 txr-d40e8bd6d7956f757bffd34c7288fd996e617c1e.zip |
lib: don't assume time_t is signed.
We introduce the function c_time to convert a Lisp integer
to time_t, and num_time to do the reverse conversion.
The FFI type time-t already does this right.
(See registration of time-t in ffi_init_extra_types).
* hash.c (gen_hash_seed): The first value out of time_sec_usec
corresponds to a time_t value. We now convert this to C number
using c_time rather than c_num. Also, while we are touching
this code, the microseconds value can convert directly to
ucnum with c_unum.
* lib.c (time_sec_usec): Use num_time for seconds.
(time_string_local, time_string_utc, time_fields_local,
time_fields_utc, time_struct_local, time_struct_utc): Use c_time.
(make_time_impl, time_parse_utc): Use num_time instead of num.
* signal.h (getitimer_wrap, setitimer_wrap): Convert tv_sec
members of struct timeval using c_time and num_time.
* sysif.c (c_time, num_time): New functions.
(stat_to_struct): Convert st_atime, st_mtime and st_ctime
to Lisp using num_time instead of num.
* sysif.c (c_time, num_time): Declared.
Diffstat (limited to 'sysif.h')
-rw-r--r-- | sysif.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -53,6 +53,8 @@ val usleep_wrap(val usec); #if HAVE_FORK_STUFF val exec_wrap(val file, val args_opt); #endif +time_t c_time(val time); +val num_time(time_t time); #if HAVE_SYS_STAT struct stat; val stat_to_struct(struct stat st, val path); |