summaryrefslogtreecommitdiff
path: root/src/timefns.c
Commit message (Collapse)AuthorAgeFilesLines
* ; Add 2024 to copyright yearsPo Lu2024-01-021-1/+1
|
* Fix system time sampling on MS-WindowsEli Zaretskii2023-03-241-0/+9
| | | | | | * src/timefns.c (emacs_localtime_rz) [WINDOWSNT]: Unconditionally call tzset to make sure we pick up all the changes of time zone, working around the MS CRT caching.
* ; Add 2023 to copyright years.Eli Zaretskii2023-01-011-1/+1
|
* ; Avoid compilation warning on MS-WindowsEli Zaretskii2022-12-121-0/+4
| | | | | * src/timefns.c (sys_clock): Declare, to avoid compilation warning.
* Work around lsp-mode compatibility bugPaul Eggert2022-11-241-1/+1
| | | | | * src/timefns.c (Ftime_subtract): Respect current-time-list when args are eq (Bug#59506).
* Improve timefns speed on integersPaul Eggert2022-08-141-4/+15
| | | | | | * src/timefns.c (decode_lisp_time) [FASTER_TIMEFNS]: Speed up when SPECIFIED_TIME is an integer. (time_cmp) [FASTER_TIMEFNS]: Speed up when comparing integers.
* Decode time conses before floatsPaul Eggert2022-08-141-11/+11
| | | | | * src/timefns.c (decode_lisp_time): Test for conses before floats, as conses are more common.
* * lisp/calendar/time-date.el (seconds-to-time): Use the original arg listStefan Monnier2022-08-141-3/+10
|
* Document time-convert FORM argument as mandatoryBasil L. Contovounesios2022-08-131-3/+2
| | | | | | | | | This is a followup to commit b70369c557 of 2022-08-05 "time-convert): Deprecate calls without an explicit FORM arg". * doc/lispref/os.texi (Time Conversion): * src/timefns.c (Ftime_convert): Describe FORM argument as required as per the advertised calling convention.
* Improve time-convert docstring formatting for readabilityStefan Kangas2022-08-131-6/+12
| | | | | * src/timefns.c (Ftime_convert): Doc fix; improve formatting for readability.
* * src/timefns.c (Ffloat_time): Fix doc string.Paul Eggert2022-08-011-1/+1
|
* Improve time-equal-p etc. performancePaul Eggert2022-08-011-1/+7
| | | | | | * src/timefns.c (time_cmp): Return EMACS_INT, not int; no need to change callers. Compare (X . Z) to (Y . Z) quickly if X and Y are fixnums.
* Improve float-time etc. performancePaul Eggert2022-08-011-20/+19
| | | | | | | | | | | * src/timefns.c (decode_float_time): Assume T is finite. All callers changed. (decode_time_components): Assume FORM is not TIMEFORM_FLOAT. All callers changed. (decode_lisp_time): If the specified time is a float, signal an error if it is not finite. (Ffloat_time): If the specified time is a float, simply return it.
* Make time arithmetic more like comparisonPaul Eggert2022-08-011-33/+11
| | | | | | | | | | | Since time comparison says X == X, have time arithmetic behave similarly for X - X. This should also be a bit faster due to not having to test for floats and NaNs. * src/timefns.c (time_arith, time_cmp): Simplify by not worrying about NaNs, which are not time values. (time_arith): Simplify by not worrying about subtracting nil from nil; the caller now handles this. (Ftime_subtract): Handle subtracting X from X specially.
* (time-equal-p nil X) returns nilPaul Eggert2022-08-011-1/+3
| | | | * src/timefns.c (Ftime_equal_p): nil compares unequal to non-nil.
* Improve time parsing documentationLars Ingebrigtsen2022-06-171-1/+1
| | | | | | * doc/lispref/os.texi (Time Parsing): Clarify which functions take/return timestamps and which ones take decoded time structures. * src/timefns.c (Fdecode_time): Clarify TIME argument (bug#46505).
* Streamline time decoding and conversionPaul Eggert2022-06-151-7/+9
| | | | | | * src/lisp.h (lisp_h_BASE2_EQ, BASE2_EQ): New macros and functions. * src/timefns.c (tzlookup, Fdecode_time): Use them. (Ftime_convert): Convert to symbol once, instead of many times.
* Prefer BASE_EQ in time-sensitive opsPaul Eggert2022-06-151-15/+15
| | | | | | | * src/timefns.c (tzlookup, lisp_time_hz_ticks) (decode_time_components, lisp_to_timespec, lispint_arith) (time_arith, time_cmp, Fdecode_time, Fencode_time) (Ftime_convert): Prefer BASE_EQ to EQ where either will do.
* ; Fix typo in documentation of 'current-time-list'Eli Zaretskii2022-04-291-1/+1
| | | | | | * src/timefns.c (syms_of_timefns) <current-time-list>: * etc/NEWS: * doc/lispref/os.texi (Time of Day): Fix a typo.
* Change current-time back to list formPaul Eggert2022-04-281-17/+31
| | | | | | | | | | | Change current-time and related functions back to using the traditional list form. Also, add a new boolean variable current-time-list that lets people try out (TICKS . HZ) form, with the goal of smoothing the transition. * src/timefns.c (CURRENT_TIME_LIST): Change default back to true. (current-time-list): New boolean Lisp variable, which defaults to CURRENT_TIME_LIST. All uses of CURRENT_TIME_LIST changed to use current_time_list, and all documentation changed.
* Add new function current-cpu-timeStefan Monnier2022-04-271-0/+15
| | | | | * doc/lispref/os.texi (Time of Day): Document it. * src/timefns.c (Fcurrent_cpu_time): New function (bug#44674).
* Use (TICKS . HZ) for current-time etc.Paul Eggert2022-04-251-14/+12
| | | | | * src/timefns.c (CURRENT_TIME_LIST): Change default to false. All documentation changed.
* Support (encode-time (list s m h D M Y))Paul Eggert2022-04-251-6/+15
| | | | | | * src/timefns.c (Fencode_time): Add support for a 6-elt list arg. Requested by Max Nikulin for Org (bug#54764). * test/src/timefns-tests.el (encode-time-alternate-apis): New test.
* Document encode-time caveatsPaul Eggert2022-04-161-9/+7
| | | | | | | | | | | | | | | | * doc/lispref/os.texi (Time of Day, Time Conversion): Move the warnings about DST being -1 to closer to where DST is discussed, and reword and improve the discussions and warnings. Be more precise about years before 1969 (possible west of UTC) vs the Epoch. Mention some problems due to leap seconds, leap years, daylight saving transitions, and time zone changes. Modernize discussion of OS timestamp range. Prefer secular ‘BCE’ to religious ‘BC’. Omit discussion of decoded-time-add and make-decoded-time, as they are in a library and are not always available; instead, mention the library. Warn about common mistakes when doing simple date arithmetic. * src/timefns.c (Fencode_time): In doc string, mention date arithmetic and tighten up the wording a bit.
* Stress difference of new and old ways to call `encode-time'Max Nikulin2022-04-161-0/+4
| | | | | | | | | | | | | | | * doc/lispref/os.texi (Time Conversion): Add a warning that blind changing of code calling `encode-time' to use single list instead of multiple values may cause deferred bugs since it is common to use nil for ignored arguments such as DST in the old calling convention. * src/timefns.c (encode-time): Mention the warning added to the elisp reference in the docstring. Refactoring related to `encode-time' caused (bug#54731), so it is better to make apparent the difference between the recommended and the obsolescent ways to call the function. More details concerning the purpose and limitations of the DST field are added after discussion with Paul Eggert in (bug#54764).
* New time-equal-p testPaul Eggert2022-04-141-1/+2
| | | | * test/src/timefns-tests.el (time-equal-p-NaN-NaN): New test.
* Avoid possibly unnecessary lisp_time_struct callPhilip Kaludercic2022-04-141-2/+1
| | | | | * timefns.c (time_cmp): Defer the calculation of the time struct, in case A and B are eq to one another.
* Remove unused fns/data and make fns staticPaul Eggert2022-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | * src/comp.c (saved_sigset, helper_temp_output_buffer_setup): Remove; unused. * src/comp.c (logfile, helper_link_table): * src/fns.c (hashfn_equal, hashfn_eql): * src/frame.c (frame_windows_min_size): * src/gnutls.c (emacs_gnutls_global_init): * src/minibuf.c (Vcommand_loop_level_list): * src/syntax.c (syntax_code_spec): * src/timefns.c (time_overflow): * src/xterm.c (x_xrender_color_from_gc_foreground) (x_display_set_last_user_time): Now static, since it’s not used elsewhere. * src/xterm.c (x_xrender_color_from_gc_foreground) (x_xrender_color_from_gc_background): Move earlier to avoid forward use. (x_xrender_color_from_gc_foreground): Do not define unless !defined USE_CAIRO && (RENDER_MAJOR > 0 || RENDER_MINOR >= 2), since it’s not used otherwise.
* Fix process-attributes time precision on GNU/LinuxPaul Eggert2022-03-041-1/+1
| | | | | | | | | | | | | | | * src/sysdep.c [GNU_LINUX]: (time_from_jiffies): Simplify by using time-convert. Change args and result type. All uses changed. (ltime_from_jiffies): Remove; call time_from_jiffies instead. (put_jiffies): New function. (get_up_time): Return Lisp_Object not struct timespec. All uses changed. Simplify by using time-add. (system_process_attributes): Simplify by using the above. This fixes some minor problems where timestamps promised more precision than was actually available. When info is not available (e.g., sysconf fails) do not place it into the alist. * src/timefns.c (float_time): Now extern.
* Avoid unnecessary make_float in time arithmeticPaul Eggert2022-03-041-4/+12
| | | | | * src/timefns.c (float_time): New function. (time_arith, Ffloat_time): Use it.
* Merge remote-tracking branch 'origin/emacs-28' into trunkStefan Monnier2022-01-021-3/+4
|\
| * Clarify %g and %G time format specsEli Zaretskii2022-01-021-3/+4
| | | | | | | | | | * src/timefns.c (Fformat_time_string): * doc/lispref/os.texi (Time Parsing): Clarify %g/%G. (Bug#52934)
* | Merge from origin/emacs-28Eli Zaretskii2022-01-011-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 836be7a112 ; * etc/refcards/ru-refcard.tex: Update Copyright year. 86cbc6ee4a * lisp/net/tramp-sh.el: Adapt copyright year ebe8772f65 ; Minor fixes related to copyright years 23c1ee6989 ; * test/manual/etags/ETAGS.good_N: Adjust to copyright ye... 8d3fc7ec89 * src/xfaces.c (face_for_font): Make 'hash' be uintptr_t. 19dcb237b5 ; Add 2022 to copyright years. # Conflicts: # etc/NEWS # etc/refcards/ru-refcard.tex # lib/cdefs.h # lisp/erc/erc-dcc.el # lisp/erc/erc-imenu.el # lisp/erc/erc-replace.el # lisp/image-dired.el # lisp/progmodes/xref.el # m4/alloca.m4 # m4/byteswap.m4 # m4/errno_h.m4 # m4/getopt.m4 # m4/gnulib-common.m4 # m4/inttypes.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/sys_socket_h.m4
| * ; Add 2022 to copyright years.Eli Zaretskii2022-01-011-1/+1
| |
* | * src/timefns.c: Minor comment fix.Paul Eggert2021-12-161-2/+1
| |
* | Omit temporary warning re obsolete timestampsPaul Eggert2021-12-161-49/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Do not warn about timestamps like (1 . 1000). This warning was added in Emacs 27 as a temporary transition aid, and has now served its purpose. These timestamps, which Emacs 26 and earlier treated as (HI . LO) instead of as (TICKS . HZ), were never generated by Emacs primitives, and in practice the warning seems to have been triggered only by test cases designed to generate it. * src/timefns.c (WARN_OBSOLETE_TIMESTAMPS): Remove. All uses changed to assume it’s false. (decode_lisp_time): Simplify by taking a bool instead of an integer bitmask. All uses changed.
* | Fix encode-time doc stringPaul Eggert2021-12-161-6/+5
|/ | | | | | * src/timefns.c (Fencode_time): Fix incorrect doc string that talks about FORM (which doesn’t exist) by copying wording from the manual instead.
* Work around GCC bug 102671Paul Eggert2021-10-111-0/+5
| | | | | This is for --enable-gcc-warnings on GCC 11.2.1. * src/window.c, src/timefns.c: Disable -Wanalyzer-null-dereference.
* Update copyright year to 2021Paul Eggert2021-01-011-1/+1
| | | | Run "TZ=UTC0 admin/update-copyright".
* Use the full name of the null byte/character, not its abbreviationAndreas Schwab2020-10-051-3/+3
| | | | | | | | | | | | | | | | | | | | | * lisp/subr.el (inhibit-nul-byte-detection): Make it an obsolete alias. * src/coding.c (setup_coding_system): Use original name. (detect_coding): Rename nul_byte_found => null_byte_found. (detect_coding_system): Use original name. Rename nul_byte_found => null_byte_found. (Fdefine_coding_system_internal): Use original name. (syms_of_coding): Rename inhibit-nul-byte-detection to inhibit-null-byte-detection. * src/w16select.c (get_clipboard_data): Rename nul_char to null_char. * src/json.c (check_string_without_embedded_nulls): Rename from check_string_without_embedded_nuls. (Fjson_parse_string): Adjust accordingly. * src/coding.h (enum define_coding_undecided_arg_index) (enum coding_attr_index): Rename ...nul_byte... to ...null_byte.... * lisp/info.el (info-insert-file-contents, Info-insert-dir): * lisp/international/mule.el (define-coding-system): * lisp/vc/vc-git.el (vc-git--call): * doc/lispref/nonascii.texi (Lisp and Coding Systems): Use original name.
* Simplify format_time_stringPaul Eggert2020-08-161-18/+15
| | | | | | * src/timefns.c (emacs_nmemftime, format_time_string): Simplify on the basis of recent nstrftime changes. Propagate nstrftime errno.
* Prefer make_nil_vector to make-vector with nilPaul Eggert2020-08-111-1/+1
| | | | | | | * src/pdumper.c (hash_table_thaw): Pacify -Wconversion so we can use make_nil_vector again. * src/timefns.c (syms_of_timefns): Prefer make_nil_vector to make_vector with Qnil.
* Tiny simplification of frac_to_doublePaul Eggert2020-03-191-2/+1
| | | | | * src/timefns.c (frac_to_double): Remove unnecessary runtime check, since the denominator is always positive.
* Omit timestamp optimization invalid on 387 FPUPaul Eggert2020-03-191-3/+0
| | | | | | * src/timefns.c (frac_to_double): Omit optimization that is invalid on machines with excess precision (e.g., gcc x86 with 387 FPU), because it double-rounds. Found via ‘gcc -m32’ on x86-64.
* Merge from origin/emacs-27Paul Eggert2020-03-081-7/+42
|\ | | | | | | | | cf223dc928 ; * src/timefns.c: Fix typo in previous change. 20d3d3a950 * src/timefns.c: Add comments.
| * ; * src/timefns.c: Fix typo in previous change.Paul Eggert2020-03-081-1/+1
| |
| * * src/timefns.c: Add comments.Paul Eggert2020-03-081-7/+42
| |
* | Merge from origin/emacs-27Paul Eggert2020-03-081-8/+24
|\| | | | | | | | | | | | | | | 0a3682a566 * src/timefns.c: Add comments. b16ba4041d ; lisp/emacs-lisp/seq.el: Explain why we don't use cl-lib ... 3cbf4cb796 Eliminate use of cl-concatenate in 'seq' package 363d927086 Fix bug with JIT stealth timers 818333c85a * doc/lispref/os.texi (time-subtract): Doc fix.
| * * src/timefns.c: Add comments.Paul Eggert2020-03-081-8/+24
| |
* | Merge from origin/emacs-27Glenn Morris2020-03-041-3/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a4e4510ccd Fix handling MS-Windows keyboard input above the BMP a38bebb0c1 * etc/NEWS: More complete description of rx 'not' changes. d373647e8f ; * doc/emacs/mini.texi (Yes or No Prompts): Fix last change. 1ca6d15656 * doc/emacs/mini.texi (Yes or No Prompts): 'y-or-n-p' now ... fe1a447d52 Don't attempt to cache glyph metrics for FONT_INVALID_CODE b42b894d1d Fix fit-frame-to-buffer for multi-monitor setup 366fd4fd07 (emacs-27) ; * etc/NEWS: Fix typo. 49d3cd90bd rx: Improve 'or' compositionality (bug#37659) 6b48aedb6b * lisp/tab-line.el: Fix auto-hscrolling (bug#39649) c5f255d681 (tag: emacs-27.0.90) ; Update lisp/ldefs-boot.el 60c84ad992 ; * etc/TODO: Fix last change. 5af9e5baad ; Add an entry to TODO d424195905 Fix rx charset generation 9908b5a614 Merge branch 'emacs-27' of git.savannah.gnu.org:/srv/git/e... 6dc2ebe00e Fix overquoting in mule.el 5cca73dd82 * src/timefns.c (time_arith): Omit incorrect comment. d767c357ca Merge branch 'emacs-27' of git.savannah.gnu.org:/srv/git/e... 4dec693f70 * lisp/vc/vc-cvs.el (vc-cvs-ignore): Copy-edit doc string ff729e3f97 ; bug#39779: Fix some typos in documentation. 696ee02c3a checkdoc: Don't mistake "cf." for sentence end # Conflicts: # etc/NEWS