Remove building with NOCRYPTO option
[minix3.git] / sys / arch / i386 / stand / lib / getsecs.c
blobe5c9daa58c1796e1bea15329d3bf5501f7fb3ca4
1 /* $NetBSD: getsecs.c,v 1.4 2009/01/12 11:32:44 tsutsui 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;