diff options
| author | Richard M. Stallman | 1996-05-07 18:55:40 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-05-07 18:55:40 +0000 |
| commit | 6ee9061cfdcde5e2def20f743fadf5e68eae11df (patch) | |
| tree | c9511057636ec43f3084e712ca209ab8b389a4ea /src | |
| parent | 305851165abb83e013ece91b4188640b3ff37d56 (diff) | |
| download | emacs-6ee9061cfdcde5e2def20f743fadf5e68eae11df.tar.gz emacs-6ee9061cfdcde5e2def20f743fadf5e68eae11df.zip | |
(Fencode_time): Accept MANY args, so as to cope
with the value of decode-time.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/src/editfns.c b/src/editfns.c index 8a6733fb5e3..4c98e851e1d 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -708,36 +708,44 @@ ZONE is an integer indicating the number of seconds east of Greenwich.\n\ | |||
| 708 | return Flist (9, list_args); | 708 | return Flist (9, list_args); |
| 709 | } | 709 | } |
| 710 | 710 | ||
| 711 | DEFUN ("encode-time", Fencode_time, Sencode_time, 6, 7, 0, | 711 | DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0, |
| 712 | "Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time.\n\ | 712 | "Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time.\n\ |
| 713 | This is the reverse operation of `decode-time', which see. ZONE defaults\n\ | 713 | This is the reverse operation of `decode-time', which see.\n\ |
| 714 | to the current time zone rule if not specified; if specified, it can\n\ | 714 | ZONE defaults to the current time zone rule. This can\n\ |
| 715 | be a string (as from `set-time-zone-rule'), or it can be a list\n\ | 715 | be a string (as from `set-time-zone-rule'), or it can be a list\n\ |
| 716 | (as from `current-time-zone') or an integer (as from `decode-time')\n\ | 716 | (as from `current-time-zone') or an integer (as from `decode-time')\n\ |
| 717 | applied without consideration for daylight savings time.\n\ | 717 | applied without consideration for daylight savings time.\n\ |
| 718 | \n\ | ||
| 719 | You can pass more than 7 arguments; then the first six arguments\n\ | ||
| 720 | are used as SECOND through YEAR, and the *last* argument is used as ZONE.\n\ | ||
| 721 | The intervening arguments are ignored.\n\ | ||
| 722 | This feature lets (apply 'encode-time (decode-time ...)) work.\n\ | ||
| 723 | \n\ | ||
| 718 | Out-of-range values for SEC, MINUTE, HOUR, DAY, or MONTH are allowed;\n\ | 724 | Out-of-range values for SEC, MINUTE, HOUR, DAY, or MONTH are allowed;\n\ |
| 719 | for example, a DAY of 0 means the day preceding the given month.\n\ | 725 | for example, a DAY of 0 means the day preceding the given month.\n\ |
| 720 | Year numbers less than 100 are treated just like other year numbers.\n\ | 726 | Year numbers less than 100 are treated just like other year numbers.\n\ |
| 721 | If you want them to stand for years in this century, you must do that yourself.") | 727 | If you want them to stand for years in this century, you must do that yourself.") |
| 722 | (second, minute, hour, day, month, year, zone) | 728 | (nargs, args) |
| 723 | Lisp_Object second, minute, hour, day, month, year, zone; | 729 | int nargs; |
| 730 | register Lisp_Object *args; | ||
| 724 | { | 731 | { |
| 725 | time_t time; | 732 | time_t time; |
| 726 | struct tm tm; | 733 | struct tm tm; |
| 727 | 734 | Lisp_Object zone = (nargs > 6)? args[nargs - 1] : Qnil; | |
| 728 | CHECK_NUMBER (second, 0); | 735 | |
| 729 | CHECK_NUMBER (minute, 1); | 736 | CHECK_NUMBER (args[0], 0); /* second */ |
| 730 | CHECK_NUMBER (hour, 2); | 737 | CHECK_NUMBER (args[1], 1); /* minute */ |
| 731 | CHECK_NUMBER (day, 3); | 738 | CHECK_NUMBER (args[2], 2); /* hour */ |
| 732 | CHECK_NUMBER (month, 4); | 739 | CHECK_NUMBER (args[3], 3); /* day */ |
| 733 | CHECK_NUMBER (year, 5); | 740 | CHECK_NUMBER (args[4], 4); /* month */ |
| 734 | 741 | CHECK_NUMBER (args[5], 5); /* year */ | |
| 735 | tm.tm_sec = XINT (second); | 742 | |
| 736 | tm.tm_min = XINT (minute); | 743 | tm.tm_sec = XINT (args[0]); |
| 737 | tm.tm_hour = XINT (hour); | 744 | tm.tm_min = XINT (args[1]); |
| 738 | tm.tm_mday = XINT (day); | 745 | tm.tm_hour = XINT (args[2]); |
| 739 | tm.tm_mon = XINT (month) - 1; | 746 | tm.tm_mday = XINT (args[3]); |
| 740 | tm.tm_year = XINT (year) - 1900; | 747 | tm.tm_mon = XINT (args[4]) - 1; |
| 748 | tm.tm_year = XINT (args[5]) - 1900; | ||
| 741 | tm.tm_isdst = -1; | 749 | tm.tm_isdst = -1; |
| 742 | 750 | ||
| 743 | if (CONSP (zone)) | 751 | if (CONSP (zone)) |