time: basic utility for getting the system time
PATCH 1/1 time: basic utility for getting the system time
Timeouts are sometimes overkill for long timeouts, or timeouts that don't require being immediately serviced once expired. For this reason the 'time' module was added which allows you to get the system clock time, as well as some basic APIs to check if two time values are before/after one another, and for calculating an offset from a start time. This allows an application to handle its own timeouts lazily with no tie to the main loop.
The APIs were modeled after the kernel APIs in jiffies.h
--- Makefile.am | 6 ++-- ell/ell.sym | 6 ++++ ell/time.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++ ell/time.h | 45 ++++++++++++++++++++++++++ 4 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 ell/time.c create mode 100644 ell/time.h
Makefile.am +4 -2
@@ -51,7 +51,8 @@ pkginclude_HEADERS = ell/ell.h \ ell/dhcp.h \ ell/cert.h \ ell/ecc.h \ - ell/ecdh.h + ell/ecdh.h \ + ell/time.h lib_LTLIBRARIES = ell/libell.la
@@ -121,7 +122,8 @@ ell_libell_la_SOURCES = $(linux_headers) \ ell/ecc.h \ ell/ecc-external.c \ ell/ecc.c \ - ell/ecdh.c + ell/ecdh.c \ + ell/time.c ell_libell_la_LDFLAGS = -no-undefined \ -Wl,--version-script=$(top_srcdir)/ell/ell.sym \
ell/ell.sym +6 -0
@@ -485,6 +485,12 @@ global: /* ecdh */ l_ecdh_generate_key_pair; l_ecdh_generate_shared_secret; + + /* time */ + l_time_now; + l_time_after; + l_time_before; + l_time_offset; local: *; };
ell/time.c new file +93 -0
93 lines not on this page · raw message
ell/time.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.17.1