Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / i386 / stand / lib / getsecs.c
blob02e411991cbe4d1d81423644d3d8f6a0867b8c6d
1 /* $NetBSD: getsecs.c,v 1.3 2008/12/14 17:03:43 christos Exp $ */
3 /* extracted from netbsd:sys/arch/i386/netboot/misc.c */
5 #include <sys/types.h>
7 #include <lib/libsa/stand.h>
8 #include <lib/libsa/net.h>
10 #include "libi386.h"
12 static inline u_long bcd2dec(u_long);
14 static inline u_long
15 bcd2dec(u_long arg)
17 return (arg >> 4) * 10 + (arg & 0x0f);
20 satime_t
21 getsecs(void) {
23 * Return the current time in seconds
26 u_long t;
27 satime_t sec;
29 if (biosgetrtc(&t))
30 panic("RTC invalid");
32 sec = bcd2dec(t & 0xff);
33 sec *= 60;
34 t >>= 8;
35 sec += bcd2dec(t & 0xff);
36 sec *= 60;
37 t >>= 8;
38 sec += bcd2dec(t & 0xff);
40 return sec;