diff options
Diffstat (limited to 'src/systime.h')
-rw-r--r-- | src/systime.h | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/src/systime.h b/src/systime.h index 6940dc4d1a6..1812f073f35 100644 --- a/src/systime.h +++ b/src/systime.h @@ -19,16 +19,15 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #ifndef EMACS_SYSTIME_H #define EMACS_SYSTIME_H +#include "lisp.h" #include <timespec.h> INLINE_HEADER_BEGIN -#ifdef emacs -# ifdef HAVE_X_WINDOWS -# include <X11/X.h> -# else +#ifdef HAVE_X_WINDOWS +# include <X11/X.h> +#else typedef unsigned long Time; -# endif #endif /* On some configurations (hpux8.0, X11R4), sys/time.h and X11/Xos.h @@ -58,52 +57,44 @@ invalid_timespec (void) } /* Return true if TIME is a valid timespec. This currently doesn't worry - about whether tv_nsec is less than TIMESPEC_RESOLUTION; leap seconds - might cause a problem if it did. */ + about whether tv_nsec is less than TIMESPEC_HZ; leap seconds might + cause a problem if it did. */ INLINE bool timespec_valid_p (struct timespec t) { return t.tv_nsec >= 0; } -/* Return current system time. */ -INLINE struct timespec -current_timespec (void) -{ - struct timespec r; - gettime (&r); - return r; -} - /* defined in sysdep.c */ extern int set_file_times (int, const char *, struct timespec, struct timespec); -extern struct timeval make_timeval (struct timespec) ATTRIBUTE_CONST; /* defined in keyboard.c */ extern void set_waiting_for_input (struct timespec *); -/* When lisp.h is not included Lisp_Object is not defined (this can - happen when this file is used outside the src directory). */ -#ifdef emacs - /* Emacs uses the integer list (HI LO US PS) to represent the time (HI << LO_TIME_BITS) + LO + US / 1e6 + PS / 1e12. */ enum { LO_TIME_BITS = 16 }; -/* A Lisp time (HI LO US PS), sans the cons cells. */ +/* Components of a new-format Lisp timestamp. */ struct lisp_time { - EMACS_INT hi; - int lo, us, ps; + /* Clock count as a Lisp integer. */ + Lisp_Object ticks; + + /* Clock frequency (ticks per second) as a positive Lisp integer. + (TICKS . HZ) is a valid Lisp timestamp unless HZ < 65536. */ + Lisp_Object hz; }; -/* defined in editfns.c */ +/* defined in timefns.c */ +extern struct timeval make_timeval (struct timespec) ATTRIBUTE_CONST; extern Lisp_Object make_lisp_time (struct timespec); -extern int decode_time_components (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, struct lisp_time *, double *); -extern struct timespec lisp_to_timespec (struct lisp_time); +extern bool list4_to_timespec (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, struct timespec *); extern struct timespec lisp_time_argument (Lisp_Object); -#endif +extern _Noreturn void time_overflow (void); +extern void init_timefns (bool); +extern void syms_of_timefns (void); INLINE_HEADER_END |