summaryrefslogtreecommitdiff
path: root/libguile/stime.c
AgeCommit message (Collapse)AuthorFilesLines
2015-10-25Adapt stime.c to gnulib updateswip-stimeAndy Wingo1-329/+167
* libguile/stime.c: Rely on gnulib to provide time.h and strptime. (timet): Remove this internal define; replaced with time_t. (scm_from_struct_tm): Rename from filltime. Take the zone to set as an SCM. (scm_to_timezone, scm_struct_tm_zone_name): New helpers. (scm_to_struct_tm_and_timezone): Rename from bdtime2c and parse out a timezone_t as well. (scm_localtime): Use localtime_rz to avoid having to call tzset. (scm_gmtime): Use gmtime_r. (scm_mktime): Use mktime_z. (scm_strftime): Use the timezone_t argument to nstrftime. Use nstrftime with a NULL buffer to measure how big of a buffer to allocate. (scm_strptime): Use scm_from_struct_tm.
2014-04-25Merge branch 'stable-2.0'v2.1.0Mark H Weaver1-3/+2
Conflicts: GUILE-VERSION NEWS guile-readline/ice-9/readline.scm libguile/async.c libguile/backtrace.c libguile/deprecated.h libguile/gc-malloc.c libguile/gdbint.c libguile/init.c libguile/ioext.c libguile/mallocs.c libguile/print.c libguile/rw.c libguile/scmsigs.c libguile/script.c libguile/simpos.c libguile/snarf.h libguile/strports.c libguile/threads.c libguile/vm-i-scheme.c libguile/vm-i-system.c module/srfi/srfi-18.scm test-suite/Makefile.am test-suite/standalone/test-num2integral.c
2014-02-27Rely on Gnulib for <unistd.h>.Mark H Weaver1-3/+2
* libguile/async.c: * libguile/backtrace.c: * libguile/error.c: * libguile/filesys.c: * libguile/fports.c: * libguile/gc-malloc.c: * libguile/gc.c: * libguile/gdbint.c: * libguile/init.c: * libguile/ioext.c: * libguile/load.c: * libguile/mallocs.c: * libguile/mkstemp.c: * libguile/ports.c: * libguile/posix.c: * libguile/r6rs-ports.c: * libguile/random.c: * libguile/rw.c: * libguile/scmsigs.c: * libguile/script.c: * libguile/simpos.c: * libguile/socket.c: * libguile/stime.c: * libguile/strports.c: * libguile/threads.c: Unconditionally include <unistd.h>.
2014-02-08Change uses of scm_is_simple_vector to scm_is_vectorDaniel Llorens1-1/+1
* libguile/filesys.c, libguile/random.c, libguile/stime.c, libguile/trees.c, libguile/validate.h: use scm_is_vector instead of scm_is_simple_vector. * libguile/sort.c (scm_sort_x, scm_sort, scm_stable_sort_x) (scm_stable_sort): Remove scm_is_vector check; scm_is_array is sufficient. * test-suite/tests/arrays.test: Fix header. * test-suite/tests/random.test: New coverage test covering random:normal-vector!. * test-suite/Makefile.am: Include random.test in make check.
2013-04-10stime: Remove #ifdef HAVE_*_H for headers provided by Gnulib.Ludovic Courtès1-10/+2
* libguile/stime.c: Remove #ifdef HAVE_SYS_TIMES_H, HAVE_SYS_TYPES_H, and HAVE_STRING_H since those headers are always provided by Gnulib when the corresponding macro is undefined. Fixes a regression on MinGW introduced by commit 40e2a31.
2013-04-09fix stime patch for HAVE_TIMES removalAndy Wingo1-3/+14
* libguile/stime.c (scm_init_stime): Fix previous patch. At this point in the source, we definitely have a run-time function, but don't necessarily have a real-time function.
2013-04-09simplify configure checks for functionality provided by gnulibAndy Wingo1-21/+0
* configure.ac: Remove checks for pipe, stftime, times, and select, as our Gnulib modules already ensure they are provided. * libguile/stime.c: Rely on gnulib providing `times'.
2013-03-09simplify stime back-compat shims for tznameAndy Wingo1-8/+1
* libguile/stime.c: Remove tzname declarations for ancient mingw and SGI RS6000.
2012-02-02Improve the usage of variable names in C docstrings.Bake Timmons1-8/+9
* libguile/alist.c: * libguile/array-map.c: * libguile/arrays.c: * libguile/bitvectors.c: * libguile/filesys.c: * libguile/foreign.c: * libguile/generalized-arrays.c: * libguile/hashtab.c: * libguile/ioext.c: * libguile/load.c: * libguile/numbers.c: * libguile/ports.c: * libguile/posix.c: * libguile/print.c: * libguile/procprop.c: * libguile/promises.c: * libguile/simpos.c: * libguile/socket.c: * libguile/srfi-1.c: * libguile/srfi-13.c: * libguile/srfi-14.c: * libguile/stacks.c: * libguile/stime.c: * libguile/strings.c: * libguile/struct.c: * libguile/symbols.c: * libguile/threads.c: * libguile/weak-table.c: * libguile/weak-vector.c: Make the variable names in the C docstrings more consistent. Replace a few instances of @var with @code when appropriate.
2011-05-20clocktime freebsd portabilityAndy Wingo1-3/+7
* libguile/stime.c (HAVE_POSIX_CPUTIME): Hack around buggy FreeBSD implementation of _POSIX_CPUTIME.
2011-05-04scm_c_get_internal_run_time is more preciseAndy Wingo1-79/+165
* libguile/stime.h (SCM_TIME_UNITS_PER_SECOND): Redefine to point to a C variable instead of being a pure preprocessor thing. This has the possibility to break existing compiled C extensions' interpretation of the internal-time-units-per-second, but hopefully there's no too much of that code out there, and in the worst case they can just recompile. Scheme code will get it right without the need to recompile. * libguile/stime.c (TIME_UNITS_PER_SECOND): New local define, and increase to nanosecond resolution if we are on a system in which this is useful and practical. (time_from_seconds_and_nanoseconds): New helper. (get_internal_real_time, get_internal_run_time): New global vars: function pointers. (get_internal_real_time_posix_timer): (get_internal_run_time_posix_timer): (get_internal_real_time_gettimeofday): (get_internal_run_time_times): (get_internal_real_time_fallback): Various implementations. (scm_get_internal_real_time): Return the get_internal_real_time() result. (scm_c_get_internal_run_time): Likewise. (scm_gettimeofday): No need for a critical section, and remove obsolete ftime block. (scm_init_stime): Init all of the new time bases, and decide on implementations of real time and run time accessors.
2011-01-07add scm_{to,from}_{utf8,latin1}_string{n,}Andy Wingo1-17/+14
* libguile/strings.h: * libguile/strings.c (scm_from_latin1_string, scm_to_latin1_string): New functions, in terms of the latin1_stringn variants. (scm_from_utf8_string, scm_from_utf8_stringn) (scm_to_utf8_string, scm_to_utf8_stringn): New functions. (scm_i_from_utf8_string, scm_i_to_utf8_string): Removed these internal functions. (scm_from_stringn): Handle -1 as a length. Unlike the previous behavior of scm_from_locale_string (NULL), which returned the empty string, we now raise an error. The null pointer is not the same as the empty string. * libguile/stime.c (scm_strftime, scm_strptime): Adapt to publishing of utf8 functions.
2009-11-17Fix stylistic issues revealed by "make syntax-check".Ludovic Courtès1-5/+4
* libguile/gc-malloc.c (scm_must_free): Remove unnecessary `if' before `free ()'. * libguile/stime.c (scm_localtime, scm_mktime): Likewise. * libguile/eval.i.c (ceval): Don't cast the result of alloca(3). * libguile/i18n.c (SCM_STRING_TO_U32_BUF): Likewise. * test-suite/standalone/test-unwind.c: Likewise. * libguile/strings.c (scm_i_deprecated_string_chars): Don't end error message in period.
2009-08-23Modify socket and time functions for wide stringsMichael Gran1-15/+35
* libguile/socket.c (scm_recv): receive the message without holding the stringbuf writing lock (scm_send): try to narrow a string before using it * libguile/stime.c (strftime): convert string to UTF-8 so that it can be safely passed to strftime (strptime): convert input string to UTF-8 so that it can be safely passed through strptime * libguile/strings.c (narrow_stringbuf): new function (scm_i_try_narrow_string): new function * libguile/strings.h: new declaration for scm_i_try_narrow_string
2009-06-17Change Guile license to LGPLv3+Neil Jerram1-6/+7
(Not quite finished, the following will be done tomorrow. module/srfi/*.scm module/rnrs/*.scm module/scripts/*.scm testsuite/*.scm guile-readline/* )
2009-05-26gnulib-tool --import environ; rely on gnulib for environ definitionsAndy Wingo1-13/+0
* libguile/posix.c: * libguile/stime.c: Remove environ definition, gnulib provides it now.
2008-09-13Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.Ludovic Courtès1-1/+1
2008-09-02Use Gnulib's `strftime' to address bug #24130.Ludovic Courtès1-4/+4
* libguile/stime.c (scm_strftime): Use `nstrftime ()' from Gnulib. This provides the same semantics on all platforms, thereby fixing bug #24130. * doc/ref/posix.texi (Time): Remove note about non-portable `%Z' behavior. Describe the new, portable behavior. * test-suite/tests/time.test ("strftime")["strftime %Z doesn't return garbage"]: Reinstate. ["C99 %z format"](have-strftime-%z): Remove. ("GMT", "EST+5"): Don't use `have-strftime-%z'.
2008-08-20Never define `_GNU_SOURCE' explicitly since `AC_USE_SYSTEM_EXTENSIONS'Ludovic Courtès1-2/+1
takes care of it. Conflicts: ChangeLog configure.in libguile/eval.c libguile/srfi-14.c libguile/threads.c
2007-08-23Changes from arch/CVS synchronizationLudovic Courtès1-1/+3
2007-08-16Add #define _REENTRANT, to get gmtime_r() prototype onKevin Ryde1-1/+2
solaris 2.6. Reported by anirkko.
2006-10-09merge from 1.8 branchKevin Ryde1-2/+16
2006-04-17merge from 1.8 branchKevin Ryde1-1/+1
2006-01-29Renamed the "frames" that are related to dynamic-wind to "dynamicMarius Vollmer1-4/+4
contexts. Renamed all functions from scm_frame_ to scm_dynwind_. Updated documentation.
2005-11-06(scm_mktime): Use scm_frame_critical_section instead ofMarius Vollmer1-2/+2
SCM_CRITICAL_SECTION_START/END since the code inside the critical section might exit non-locally.
2005-10-23(scm_strftime): Update docstring from posix.texi.Kevin Ryde1-7/+16
2005-06-05* hashtab.h: Bugfix: use SCM_API (WAS: extern).Marius Vollmer1-6/+5
* socket.c: Remove obsolete comment about socklen_t. (s_scm_setsockopt)[!HAVE_IP_MREQ]: Do not use ip_mreq code. * numbers.h (isnan)[__MINGW32__]: Remove. * Makefile.am (gen_scmconfig_SOURCES): Bugfix: Add DEFAULT_INCLUDES when cross compiling. * threads.c (ETIMEDOUT, pipe)[__MINGW32__]: Add defines. * stime.c (s_scm_strftime)[!HAVE_TM_ZONE]: Use SCM_SIMPLE_VECTOR_REF instead of SCM_VELTS. (Changed slightly from Jan's patch.)
2005-05-23The FSF has a new address.Marius Vollmer1-1/+1
2005-03-07Include "libguile/async.h" for SCM_CRITICAL_SECTION_START/END.Marius Vollmer1-0/+1
2005-03-02See ChangeLog from 2005-03-02.Marius Vollmer1-17/+17
2005-01-10(scm_mktime): Missing default errno=EINVAL from prev change.Kevin Ryde1-1/+2
2005-01-04(scm_strftime): Free t.tm_zone produced by bdtime2c.Kevin Ryde1-0/+3
Reported by Bill Schottstaedt.
2005-01-02Use new vector elements API or simple vector API, as appropriate.Marius Vollmer1-42/+32
Removed SCM_HAVE_ARRAYS ifdefery. Replaced all uses of SCM_HASHTABLE_BUCKETS with SCM_HASHTABLE_BUCKET.
2004-09-08(_POSIX_C_SOURCE): Use this only on hpux, itKevin Ryde1-1/+14
causes too many problems elsewhere (glibc, freebsd, mingw). Reported by Andreas Vögele.
2004-09-07(scm_current_time, scm_gettimeofday, scm_strptime): Don'tKevin Ryde1-8/+22
throw error before unlocking mutex with SCM_ALLOW_INTS.
2004-09-032004-09-03 Stefan Jahn <stefan@lkcc.org>Stefan Jahn1-1/+5
* configure.in (isinf): Let configure find the isinf() function on MinGW32 systems. 2004-09-03 Stefan Jahn <stefan@lkcc.org> * threads.c (scm_threads_mark_stacks): Fixed local variable definitions. * strings.c (scm_i_substring_copy, s_scm_string_append): Fixed local variable definitions. * stime.c (_POSIX_C_SOURCE): Do not define this item on MinGW32 because it conflicts with its pthread headers. (s_scm_mktime): Consider the HAVE_STRUCT_TM_TM_ZONE define. (s_scm_strftime): Using scm_from_locale_string() instead of scm_makfrom0str(). * posix.c (s_scm_putenv): Fixed typo in the !HAVE_UNSETENV part. * numbers.c (scm_init_numbers): Removed check_sanity() call inside GUILE_DEBUG. The function has been removed somewhen... * filesys.c (_POSIX_C_SOURCE): Do not define this item on MinGW32 because it conflicts with its pthread headers. 2004-09-03 Stefan Jahn <stefan@lkcc.org> * srfi-1.c, srfi-1.h: Renamed any 'lst1' into 'list1' because lst1 is a #define on Win32 systems.
2004-08-19* strings.h, strings.c: (scm_i_string_chars, scm_i_string_length,Marius Vollmer1-9/+18
scm_i_string_writable_chars, scm_i_string_stop_writing): New, to replace SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH. Updated all uses. (scm_i_make_string, scm_c_make_string): New, to replace scm_allocate_string. Updated all uses. (SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_UCHARS, SCM_STRING_LENGTH): Deprecated. (scm_allocate_string, scm_take_str, scm_take0str, scm_mem2string, scm_str2string, scm_makfrom0str, scm_makfrom0str_opt): Discouraged. Replaced all uses with scm_from_locale_string or similar, as appropriate. (scm_c_string_length, scm_c_string_ref, scm_c_string_set_x, scm_c_substring, scm_c_substring_shared, scm_c_substring_copy, scm_substring_shared, scm_substring_copy): New. * symbols.c, symbols.h (SCM_SYMBOLP, SCM_SYMBOL_FUNC, SCM_SET_SYMBOL_FUNC, SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS, SCM_SYMBOL_HASH, SCM_SYMBOL_INTERNED_P, scm_mem2symbol, scm_str2symbol, scm_mem2uninterned_symbol): Discouraged. (SCM_SYMBOL_LENGTH, SCM_SYMBOL_CHARS, scm_c_symbol2str): Deprecated. (SCM_MAKE_SYMBOL_TAG, SCM_SET_SYMBOL_LENGTH, SCM_SET_SYMBOL_CHARS, SCM_PROP_SLOTS, SCM_SET_PROP_SLOTS): Removed. (scm_is_symbol, scm_from_locale_symbol, scm_from_locale_symboln): New, to replace scm_str2symbol and scm_mem2symbol, respectively. Updated all uses. (scm_gensym): Generate only the number suffix in the buffer, just string-append the prefix.
2004-08-10* stime.c, socket.c, simpos.c, procs.c, posix.c, ports.c,Marius Vollmer1-5/+9
net_db.c, fports.c, filesys.c, eval.c, deprecation.c, dynl.c: Replaced uses of SCM_STRING_CHARS with proper uses of scm_to_locale_string. Replaced SCM_STRINGP with scm_is_string. Replaced scm_mem2string with scm_from_locale_string. * simpos.c, posix.c (allocate_string_pointers, environ_list_to_c): Removed, replaced all uses with scm_i_allocate_string_pointers.
2004-08-02* numbers.h, numbers.c, discouraged.h, discouraged.c (scm_short2num,Marius Vollmer1-16/+18
scm_ushort2num, scm_int2num, scm_uint2num, scm_long2num, scm_ulong2num, scm_size2num, scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int, scm_num2uint, scm_num2long, scm_num2ulong, scm_num2size, scm_num2ptrdiff, scm_long_long2num, scm_ulong_long2num, scm_num2long_long, scm_num2ulong_long): Discouraged by moving to discouraged.h and discouraged.c and reimplementing in terms of scm_from_* and scm_to_*. Changed all uses to the new scm_from_* and scm_to_* functions.
2004-07-23* deprecated.h, deprecated.c, numbers.h (SCM_INUMP, SCM_NINUMP,Marius Vollmer1-27/+28
SCM_INUM): Deprecated by reenaming them to SCM_I_INUMP, SCM_I_NINUMP and SCM_I_INUM, respectively and adding deprecated versions to deprecated.h and deprecated.c. Changed all uses to either use the SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate.
2004-07-08* numbers.h (SCM_MAKINUM, SCM_I_MAKINUM): Renamed SCM_MAKINUM toMarius Vollmer1-17/+17
SCM_I_MAKINUM and changed all uses.
2004-07-06* deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL,Marius Vollmer1-3/+3
SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into "deprecated.h". Replaced all uses with scm_is_false, scm_is_true, scm_from_bool, and scm_is_bool, respectively.
2004-04-27(_POSIX_C_SOURCE): Define to 199506L to get gmtime_r (inKevin Ryde1-0/+1
particular on HP-UX). Reported by Andreas Vögele.
2004-03-20(scm_gmtime): Use gmtime_r when available, for thread safety.Kevin Ryde1-7/+20
2004-03-13Define _GNU_SOURCE for strptime prototype from glibc. UseKevin Ryde1-1/+3
HAVE_DECL_STRPTIME for when to give own strptime prototype.
2004-03-06(scm_gmtime): Return bd_time->tm_zone when available, rather than "GMT" always.Kevin Ryde1-2/+8
(filltime): Make zname parameter "const".
2004-02-18(environ): Use _NSGetEnviron in DarwinKevin Ryde1-1/+14
shared library, since environ is not directly available there.
2004-02-17(scm_localtime, scm_gmtime, scm_mktime): Provide a defaultKevin Ryde1-2/+21
errno EINVAL in case localtime and gmtime don't set it. (scm_mktime, scm_strptime): Forcibly use errno EINVAL for our SCM_SYSERROR, since mktime and strptime generally don't set errno.
2004-01-03(scm_current_time, scm_gettimeofday): Add a comment aboutKevin Ryde1-1/+8
setzone/restorezone protection for DOS.
2003-09-16(scm_current_time): 'time' does not set errno so don't useMarius Vollmer1-1/+1
SCM_SYSERROR for reporting errors.