[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
/usr/bin/last calculates incorrect total time
- To: bugs@openbsd.org
- Subject: /usr/bin/last calculates incorrect total time
- From: Ilya Voronin <ivoronin@trancom.ru>
- Date: Thu, 8 Jan 2004 16:18:23 +0300
- Content-Disposition: inline
- User-Agent: Mutt/1.5.4i
/usr/bin/last calculates incorrect total time.
Environment:
OpenBSD 3.4-stable, i386
How to repeat:
root@typhoon:~# last -c | tail -n 3
Total time: 8430 days, 23:12
wtmp begins Sat Jan 3 04:06 2004
How to fix:
--- usr.bin/last/last.c Fri Aug 15 01:02:09 2003
+++ usr.bin/last/last.c Wed Jan 7 21:01:34 2004
@@ -231,7 +231,7 @@
TTY *T; /* tty list entry */
struct stat stb; /* stat of file for size */
time_t delta; /* time difference */
- time_t total;
+ time_t total = 0;
off_t bl;
int timesize; /* how long time string gonna be */
int bytes, wfd;
Result:
root@typhoon:~# last -c | tail -n 3
Total time: 6 days, 16:55
wtmp begins Sat Jan 3 04:06 2004
--
ilya voronin <ivoronin@trancom.ru>