1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-16 09:50:25 +00:00
emacs/doc
Philipp Stephani bffceab633 Add conversions to and from struct timespec to module interface.
Time values are a fundamental data type, and such conversions are hard
to implement within modules because of the various forms of time
values in Emacs Lisp.  Adding dedicated conversion functions can
significantly simplify module code dealing with times.

This approach uses nanosecond precision.  While Emacs in theory has
support for higher-precision time values, in practice most languages
and standards, such as POSIX, C, Java, and Go, have settled on
nanosecond-precision integers to represent time.

* src/emacs-module.h.in: Add header for struct timespec.

* src/module-env-27.h: Add module functions for time conversion.

* src/emacs-module.c (module_extract_time, module_make_time): New
functions.
(initialize_environment): Use them.

* test/data/emacs-module/mod-test.c (Fmod_test_add_nanosecond): New
test function.
(emacs_module_init): Define it.

* test/src/emacs-module-tests.el (mod-test-add-nanosecond/valid)
(mod-test-add-nanosecond/nil, mod-test-add-nanosecond/invalid): New
unit tests.

* doc/lispref/internals.texi (Module Values): Document time
conversion functions.
2019-04-24 11:33:52 +02:00
..
emacs Merge from origin/emacs-26 2019-04-21 07:51:38 -07:00
lispintro Merge from origin/emacs-26 2019-03-09 10:07:46 -08:00
lispref Add conversions to and from struct timespec to module interface. 2019-04-24 11:33:52 +02:00
man Merge from origin/emacs-26 2018-12-31 17:57:29 -08:00
misc Merge from origin/emacs-26 2019-04-21 07:51:38 -07:00