aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 19:48:30 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 19:51:47 +1000
commita2486b548b1636729edc34172a08fd18864e7fa8 (patch)
treee020ccd5c0accefead56124e169571e92a0bb1cf /coreutils
parent42b6a4c89ad8d4f625a3b63b7556929e3a660e90 (diff)
downloadbusybox-w32-a2486b548b1636729edc34172a08fd18864e7fa8.tar.gz
busybox-w32-a2486b548b1636729edc34172a08fd18864e7fa8.tar.bz2
busybox-w32-a2486b548b1636729edc34172a08fd18864e7fa8.zip
win32: enable date
Setting time does not work. %e does not work because strftime does not support that. Output may be different from POSIX because "it is Windows" syndrome.
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/date.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/coreutils/date.c b/coreutils/date.c
index c9dfedf81..c0faf04af 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -242,9 +242,14 @@ int date_main(int argc UNUSED_PARAM, char **argv)
242 maybe_set_utc(opt); 242 maybe_set_utc(opt);
243 243
244 /* if setting time, set it */ 244 /* if setting time, set it */
245#if ENABLE_PLATFORM_MINGW32
246 if (opt & OPT_SET)
247 bb_error_msg_and_die("Setting date is not supported");
248#else
245 if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) { 249 if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
246 bb_perror_msg("can't set date"); 250 bb_perror_msg("can't set date");
247 } 251 }
252#endif
248 } 253 }
249 254
250 /* Display output */ 255 /* Display output */
@@ -272,7 +277,11 @@ int date_main(int argc UNUSED_PARAM, char **argv)
272 i = sizeof("%a, %d %b %Y %H:%M:%S ")-1; 277 i = sizeof("%a, %d %b %Y %H:%M:%S ")-1;
273 goto format_utc; 278 goto format_utc;
274 } else { /* default case */ 279 } else { /* default case */
280#if ENABLE_PLATFORM_MINGW32
281 fmt_dt2str = (char*)"%a %b %d %H:%M:%S %Z %Y";
282#else
275 fmt_dt2str = (char*)"%a %b %e %H:%M:%S %Z %Y"; 283 fmt_dt2str = (char*)"%a %b %e %H:%M:%S %Z %Y";
284#endif
276 } 285 }
277 } 286 }
278#if ENABLE_FEATURE_DATE_NANO 287#if ENABLE_FEATURE_DATE_NANO
@@ -325,6 +334,10 @@ int date_main(int argc UNUSED_PARAM, char **argv)
325 if (strncmp(fmt_dt2str, "%f", 2) == 0) { 334 if (strncmp(fmt_dt2str, "%f", 2) == 0) {
326 fmt_dt2str = (char*)"%Y.%m.%d-%H:%M:%S"; 335 fmt_dt2str = (char*)"%Y.%m.%d-%H:%M:%S";
327 } 336 }
337#if ENABLE_PLATFORM_MINGW32
338 if (strstr(fmt_dt2str, "%e"))
339 bb_error_msg_and_die("%e is not supported by Windows strftime");
340#endif
328 /* Generate output string */ 341 /* Generate output string */
329 strftime(date_buf, sizeof(date_buf), fmt_dt2str, &tm_time); 342 strftime(date_buf, sizeof(date_buf), fmt_dt2str, &tm_time);
330 } 343 }