@matheusbsbs / matheus-bagliano / commits / da8f070cee
Fork 0

show_date(): fix relative dates

We pass a timestamp (i.e. number of seconds elapsed since Jan 1 1970, 00:00:00 GMT) to the function. So there is no need to "fix" the timestamp according to the timezone. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

Johannes Schindelin committed Jan 20, 2007 at 22:21 UTC da8f070cee6795594e4ac2af9f1e11cf9a7d3649
1 file changed +2 -3
date.c
+2 -3
@@ -62,12 +62,11 @@ const char *show_date(unsigned long time, int tz, int relative)
62
63 if (relative) {
64 unsigned long diff;
65 - time_t t = gm_time_t(time, tz);
65 struct timeval now;
66 gettimeofday(&now, NULL);
68 - if (now.tv_sec < t)
67 + if (now.tv_sec < time)
68 return "in the future";
70 - diff = now.tv_sec - t;
69 + diff = now.tv_sec - time;
70 if (diff < 90) {
71 snprintf(timebuf, sizeof(timebuf), "%lu seconds ago", diff);
72 return timebuf;