diff options
| author | Paul Eggert | 2022-08-14 13:48:11 -0700 |
|---|---|---|
| committer | Paul Eggert | 2022-08-14 13:49:33 -0700 |
| commit | 15aba5e64496414ec4659118f910516d2dc5e8b4 (patch) | |
| tree | 0f6d5b3547914c4d456c9d6addedfbd208558269 | |
| parent | 23561f9665609bcb4cbe89a993a70eeccbec600e (diff) | |
| download | emacs-15aba5e64496414ec4659118f910516d2dc5e8b4.tar.gz emacs-15aba5e64496414ec4659118f910516d2dc5e8b4.zip | |
Decode time conses before floats
* src/timefns.c (decode_lisp_time): Test for conses before floats,
as conses are more common.
| -rw-r--r-- | src/timefns.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/timefns.c b/src/timefns.c index edfd73e9b80..b9d9a4ed976 100644 --- a/src/timefns.c +++ b/src/timefns.c | |||
| @@ -822,17 +822,6 @@ decode_lisp_time (Lisp_Object specified_time, bool decode_secs_only, | |||
| 822 | 822 | ||
| 823 | if (NILP (specified_time)) | 823 | if (NILP (specified_time)) |
| 824 | form = TIMEFORM_NIL; | 824 | form = TIMEFORM_NIL; |
| 825 | else if (FLOATP (specified_time)) | ||
| 826 | { | ||
| 827 | double d = XFLOAT_DATA (specified_time); | ||
| 828 | if (!isfinite (d)) | ||
| 829 | time_error (isnan (d) ? EDOM : EOVERFLOW); | ||
| 830 | if (result) | ||
| 831 | decode_float_time (d, result); | ||
| 832 | else | ||
| 833 | *dresult = d; | ||
| 834 | return TIMEFORM_FLOAT; | ||
| 835 | } | ||
| 836 | else if (CONSP (specified_time)) | 825 | else if (CONSP (specified_time)) |
| 837 | { | 826 | { |
| 838 | high = XCAR (specified_time); | 827 | high = XCAR (specified_time); |
| @@ -872,6 +861,17 @@ decode_lisp_time (Lisp_Object specified_time, bool decode_secs_only, | |||
| 872 | if (! INTEGERP (low)) | 861 | if (! INTEGERP (low)) |
| 873 | form = TIMEFORM_INVALID; | 862 | form = TIMEFORM_INVALID; |
| 874 | } | 863 | } |
| 864 | else if (FLOATP (specified_time)) | ||
| 865 | { | ||
| 866 | double d = XFLOAT_DATA (specified_time); | ||
| 867 | if (!isfinite (d)) | ||
| 868 | time_error (isnan (d) ? EDOM : EOVERFLOW); | ||
| 869 | if (result) | ||
| 870 | decode_float_time (d, result); | ||
| 871 | else | ||
| 872 | *dresult = d; | ||
| 873 | return TIMEFORM_FLOAT; | ||
| 874 | } | ||
| 875 | 875 | ||
| 876 | int err = decode_time_components (form, high, low, usec, psec, | 876 | int err = decode_time_components (form, high, low, usec, psec, |
| 877 | result, dresult); | 877 | result, dresult); |