# define FASTER_TIMEFNS 1
#endif
-/* Whether to warn about Lisp timestamps (TICKS . HZ) that may be
- instances of obsolete-format timestamps (HI . LO) where HI is
- the high-order bits and LO the low-order 16 bits. Currently this
- is true, but it should change to false in a future version of
- Emacs. Compile with -DWARN_OBSOLETE_TIMESTAMPS=0 to see what the
- future will be like. */
-#ifndef WARN_OBSOLETE_TIMESTAMPS
-enum { WARN_OBSOLETE_TIMESTAMPS = true };
-#endif
-
/* Although current-time etc. generate list-format timestamps
(HI LO US PS), the plan is to change these functions to generate
frequency-based timestamps (TICKS . HZ) in a future release.
return decode_ticks_hz (make_integer_mpz (), hz, result, dresult);
}
-enum { DECODE_SECS_ONLY = WARN_OBSOLETE_TIMESTAMPS + 1 };
-
/* Decode a Lisp timestamp SPECIFIED_TIME that represents a time.
- FLAGS specifies conversion flags. If FLAGS & DECODE_SECS_ONLY,
- ignore and do not validate any sub-second components of an
- old-format SPECIFIED_TIME. If FLAGS & WARN_OBSOLETE_TIMESTAMPS,
- diagnose what could be obsolete (HIGH . LOW) timestamps.
+ If DECODE_SECS_ONLY, ignore and do not validate any sub-second
+ components of an old-format SPECIFIED_TIME.
If RESULT is not null, store into *RESULT the converted time;
otherwise, store into *DRESULT the number of seconds since the
Return the form of SPECIFIED-TIME. Signal an error if unsuccessful. */
static enum timeform
-decode_lisp_time (Lisp_Object specified_time, int flags,
+decode_lisp_time (Lisp_Object specified_time, bool decode_secs_only,
struct lisp_time *result, double *dresult)
{
Lisp_Object high = make_fixnum (0);
{
Lisp_Object low_tail = XCDR (low);
low = XCAR (low);
- if (! (flags & DECODE_SECS_ONLY))
+ if (! decode_secs_only)
{
if (CONSP (low_tail))
{
}
else
{
- if (flags & WARN_OBSOLETE_TIMESTAMPS
- && RANGED_FIXNUMP (0, low, (1 << LO_TIME_BITS) - 1))
- message ("obsolete timestamp with cdr %"pI"d", XFIXNUM (low));
form = TIMEFORM_TICKS_HZ;
}
lisp_time_struct (Lisp_Object specified_time, enum timeform *pform)
{
struct lisp_time t;
- enum timeform form
- = decode_lisp_time (specified_time, WARN_OBSOLETE_TIMESTAMPS, &t, 0);
+ enum timeform form = decode_lisp_time (specified_time, false, &t, 0);
if (pform)
*pform = form;
return t;
static time_t
lisp_seconds_argument (Lisp_Object specified_time)
{
- int flags = WARN_OBSOLETE_TIMESTAMPS | DECODE_SECS_ONLY;
struct lisp_time lt;
- decode_lisp_time (specified_time, flags, <, 0);
+ decode_lisp_time (specified_time, true, <, 0);
struct timespec t = lisp_to_timespec (lt);
if (! timespec_valid_p (t))
time_overflow ();
mpz_t *ihz = &mpz[0];
mpz_mul (*ihz, *fa, *db);
- /* When warning about obsolete timestamps, if the smaller
- denominator comes from a non-(TICKS . HZ) timestamp and could
- generate a (TICKS . HZ) timestamp that would look obsolete,
- arrange for the result to have a higher HZ to avoid a
- spurious warning by a later consumer of this function's
- returned value. */
- verify (1 << LO_TIME_BITS <= ULONG_MAX);
- if (WARN_OBSOLETE_TIMESTAMPS
- && (da_lt_db ? aform : bform) == TIMEFORM_FLOAT
- && (da_lt_db ? bform : aform) != TIMEFORM_TICKS_HZ
- && mpz_cmp_ui (*hzmin, 1) > 0
- && mpz_cmp_ui (*hzmin, 1 << LO_TIME_BITS) < 0)
- {
- mpz_t *hzmin1 = &mpz[2 - da_lt_db];
- mpz_set_ui (*hzmin1, 1 << LO_TIME_BITS);
- hzmin = hzmin1;
- }
-
/* iticks = (fb * na) OP (fa * nb), where OP is + or -. */
mpz_t const *na = bignum_integer (iticks, ta.ticks);
mpz_mul (*iticks, *fb, *na);
(Lisp_Object specified_time)
{
double t;
- decode_lisp_time (specified_time, 0, 0, &t);
+ decode_lisp_time (specified_time, false, 0, &t);
return make_float (t);
}
/* Let SEC = floor (LT.ticks / HZ), with SUBSECTICKS the remainder. */
struct lisp_time lt;
- decode_lisp_time (secarg, 0, <, 0);
+ decode_lisp_time (secarg, false, <, 0);
Lisp_Object hz = lt.hz, sec, subsecticks;
if (FASTER_TIMEFNS && EQ (hz, make_fixnum (1)))
{
If FORM is nil (the default), return the same form as `current-time'.
If FORM is a positive integer, return a pair of integers (TICKS . FORM),
where TICKS is the number of clock ticks and FORM is the clock frequency
-in ticks per second. (Currently the positive integer should be at least
-65536 if the returned value is expected to be given to standard functions
-expecting Lisp timestamps.) If FORM is t, return (TICKS . PHZ), where
+in ticks per second. If FORM is t, return (TICKS . PHZ), where
PHZ is a suitable clock frequency in ticks per second. If FORM is
`integer', return an integer count of seconds. If FORM is `list',
return an integer list (HIGH LOW USEC PSEC), where HIGH has the most
(Lisp_Object time, Lisp_Object form)
{
struct lisp_time t;
- enum timeform input_form = decode_lisp_time (time, 0, &t, 0);
+ enum timeform input_form = decode_lisp_time (time, false, &t, 0);
if (NILP (form))
form = CURRENT_TIME_LIST ? Qlist : Qt;
if (EQ (form, Qlist))