aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-04-22 00:45:28 -0400
committerDenys Vlasenko <vda.linux@googlemail.com>2010-04-22 00:45:28 -0400
commit5f94346f7387cb5e33cf202dd3306f062bb22052 (patch)
tree5983e762c1be88c498115c64920eec2606f4cf39
parent238c83bd8237e482911b8272e7f420060f5e7714 (diff)
downloadbusybox-w32-5f94346f7387cb5e33cf202dd3306f062bb22052.tar.gz
busybox-w32-5f94346f7387cb5e33cf202dd3306f062bb22052.tar.bz2
busybox-w32-5f94346f7387cb5e33cf202dd3306f062bb22052.zip
date: support -d @SECONDS_SINCE_1970
function old new delta parse_datestr 647 721 +74 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/time.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libbb/time.c b/libbb/time.c
index 5cd04268c..8d176e52e 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -68,6 +68,16 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
68 end = '\0'; 68 end = '\0';
69 /* else end != NUL and we error out */ 69 /* else end != NUL and we error out */
70 } 70 }
71 } else if (date_str[0] == '@') {
72 time_t t = bb_strtol(date_str + 1, NULL, 10);
73 if (!errno) {
74 struct tm *lt = localtime(&t);
75 if (lt) {
76 *ptm = *lt;
77 return;
78 }
79 }
80 end = '1';
71 } else { 81 } else {
72 /* Googled the following on an old date manpage: 82 /* Googled the following on an old date manpage:
73 * 83 *