aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/editfns.c b/src/editfns.c
index f7fb2eb03d8..5dad39d426e 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -39,6 +39,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
39#define max(a, b) ((a) > (b) ? (a) : (b)) 39#define max(a, b) ((a) > (b) ? (a) : (b))
40 40
41extern void insert_from_buffer (); 41extern void insert_from_buffer ();
42static long difftm ();
42 43
43/* Some static data, and a function to initialize it for each run */ 44/* Some static data, and a function to initialize it for each run */
44 45
@@ -703,6 +704,7 @@ ZONE is an integer indicating the number of seconds east of Greenwich.\n\
703 Lisp_Object specified_time; 704 Lisp_Object specified_time;
704{ 705{
705 time_t time_spec; 706 time_t time_spec;
707 struct tm save_tm;
706 struct tm *decoded_time; 708 struct tm *decoded_time;
707 Lisp_Object list_args[9]; 709 Lisp_Object list_args[9];
708 710
@@ -710,15 +712,22 @@ ZONE is an integer indicating the number of seconds east of Greenwich.\n\
710 error ("Invalid time specification"); 712 error ("Invalid time specification");
711 713
712 decoded_time = localtime (&time_spec); 714 decoded_time = localtime (&time_spec);
713 list_args[0] = XFASTINT (decoded_time->tm_sec); 715 XSETFASTINT (list_args[0], decoded_time->tm_sec);
714 list_args[1] = XFASTINT (decoded_time->tm_min); 716 XSETFASTINT (list_args[1], decoded_time->tm_min);
715 list_args[2] = XFASTINT (decoded_time->tm_hour); 717 XSETFASTINT (list_args[2], decoded_time->tm_hour);
716 list_args[3] = XFASTINT (decoded_time->tm_mday); 718 XSETFASTINT (list_args[3], decoded_time->tm_mday);
717 list_args[4] = XFASTINT (decoded_time->tm_mon + 1); 719 XSETFASTINT (list_args[4], decoded_time->tm_mon + 1);
718 list_args[5] = XFASTINT (decoded_time->tm_year + 1900); 720 XSETFASTINT (list_args[5], decoded_time->tm_year + 1900);
719 list_args[6] = XFASTINT (decoded_time->tm_wday); 721 XSETFASTINT (list_args[6], decoded_time->tm_wday);
720 list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil; 722 list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil;
721 list_args[8] = XINT (decoded_time->tm_gmtoff); 723
724 /* Make a copy, in case gmtime modifies the struct. */
725 save_tm = *decoded_time;
726 decoded_time = gmtime (&time_spec);
727 if (decoded_time == 0)
728 list_args[8] = Qnil;
729 else
730 XSETINT (list_args[8], difftm (&save_tm, decoded_time));
722 return Flist (9, list_args); 731 return Flist (9, list_args);
723} 732}
724 733