comparison src/editfns.c @ 5386:af961911bcb2

Make listu() and listn() assemble lists in forward order. Use them. See xemacs-patches message with ID <AANLkTi=Tnd_e8WqiGBE2DmNGmY7zhqxhVNtxECnQo8w9@mail.gmail.com>
author Jerry James <james@xemacs.org>
date Tue, 29 Mar 2011 15:59:56 -0600
parents 1ed4cefddd12
children 568ec109e73d 248176c74e6b
comparison
equal deleted inserted replaced
5385:436e67ca8c79 5386:af961911bcb2
1100 (specified_time)) 1100 (specified_time))
1101 { 1101 {
1102 time_t time_spec; 1102 time_t time_spec;
1103 struct tm save_tm; 1103 struct tm save_tm;
1104 struct tm *decoded_time; 1104 struct tm *decoded_time;
1105 Lisp_Object list_args[9];
1106 1105
1107 if (! lisp_to_time (specified_time, &time_spec)) 1106 if (! lisp_to_time (specified_time, &time_spec))
1108 invalid_argument ("Invalid time specification", Qunbound); 1107 invalid_argument ("Invalid time specification", Qunbound);
1109 1108
1110 decoded_time = localtime (&time_spec); 1109 decoded_time = localtime (&time_spec);
1111 list_args[0] = make_int (decoded_time->tm_sec);
1112 list_args[1] = make_int (decoded_time->tm_min);
1113 list_args[2] = make_int (decoded_time->tm_hour);
1114 list_args[3] = make_int (decoded_time->tm_mday);
1115 list_args[4] = make_int (decoded_time->tm_mon + 1);
1116 list_args[5] = make_int (decoded_time->tm_year + 1900);
1117 list_args[6] = make_int (decoded_time->tm_wday);
1118 list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil;
1119 1110
1120 /* Make a copy, in case gmtime modifies the struct. */ 1111 /* Make a copy, in case gmtime modifies the struct. */
1121 save_tm = *decoded_time; 1112 save_tm = *decoded_time;
1122 decoded_time = gmtime (&time_spec); 1113 decoded_time = gmtime (&time_spec);
1123 if (decoded_time == 0) 1114
1124 list_args[8] = Qnil; 1115 return listn(9,
1125 else 1116 make_int (save_tm.tm_sec),
1126 list_args[8] = make_int (difftm (&save_tm, decoded_time)); 1117 make_int (save_tm.tm_min),
1127 return Flist (9, list_args); 1118 make_int (save_tm.tm_hour),
1119 make_int (save_tm.tm_mday),
1120 make_int (save_tm.tm_mon + 1),
1121 make_int (save_tm.tm_year + 1900),
1122 make_int (save_tm.tm_wday),
1123 save_tm.tm_isdst ? Qt : Qnil,
1124 (decoded_time == NULL)
1125 ? Qnil
1126 : make_int (difftm (&save_tm, decoded_time)));
1128 } 1127 }
1129 1128
1130 static void set_time_zone_rule (Extbyte *tzstring); 1129 static void set_time_zone_rule (Extbyte *tzstring);
1131 1130
1132 /* from GNU Emacs 21, per Simon Josefsson, modified by stephen 1131 /* from GNU Emacs 21, per Simon Josefsson, modified by stephen