Hello,
the date command from linux coreutils support the following time
specification: -d @<seconds since 1970>
Together with "date +%s" this can be used to get a timestamp,
calculate with timestamps and convert a timestamp back into an actual
date.
The following patch would add this timespecification to busybox:
--- busybox-1.16.0/libbb/time.c.orig 2010-04-20 13:40:22.880476758 +0200
+++ busybox-1.16.0/libbb/time.c 2010-04-20 13:40:33.076293747 +0200
@@ -56,7 +56,17 @@
end = '\0';
/* else end != NUL and we error out */
}
- } else {
+ } else if (*date_str == '@') {
+ time_t t = { bb_strtol(date_str + 1, 0, 10) };
+ if (!errno) {
+ struct tm *lt = localtime(&t);
+ if (lt) {
+ *ptm = *lt;
+ return;
+ }
+ }
+ end = '1';
+ } else {
/* Googled the following on an old date manpage:
*
* The canonical representation for setting the date/time is:
Would it be possible to integrate this (or something like this) into
busybox?
regards,
Jean
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox