Bug 2029 - date: function error
Summary: date: function error
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All All
: P5 critical
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-10 13:18 UTC by rockeychu
Modified: 2010-06-12 01:33 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rockeychu 2010-06-10 13:18:39 UTC
A bug introduced by commit 6c2406ac861f42536acb76606c90412324a0e733 (http://lists.busybox.net/pipermail/busybox-cvs/2010-June/031293.html), which caused "date" to get invalid date time, if FEATURE_DATE_NANO not set.

A resolved patch as following:

diff --git a/coreutils/date.c b/coreutils/date.c
index c3478fa..8f9aff8 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -210,7 +210,7 @@ int date_main(int argc UNUSED_PARAM, char **argv)
 #if ENABLE_FEATURE_DATE_NANO
                clock_gettime(CLOCK_REALTIME, &ts);
 #else
-               time(&ts.tv_nsec);
+               time(&ts.tv_sec);
 #endif
        }
        localtime_r(&ts.tv_sec, &tm_time);
Comment 1 Denys Vlasenko 2010-06-12 01:33:13 UTC
Thanks! Fixed in git.