5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
27 static TIMEINFO TimeInfo
;
30 /* Some BIOSes, such as the 1998/07/25 system ROM
31 * in the Compaq Deskpro EP/SB, leave CF unchanged
32 * if successful, so CF should be cleared before
33 * calling this function. */
34 __writeeflags(__readeflags() & ~EFLAGS_CF
);
37 * TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
40 * CF clear to avoid bug
42 * CF clear if successful
50 Int386(0x1A, &Regs
, &Regs
);
52 TimeInfo
.Year
= 100 * BCD_INT(Regs
.b
.ch
) + BCD_INT(Regs
.b
.cl
);
53 TimeInfo
.Month
= BCD_INT(Regs
.b
.dh
);
54 TimeInfo
.Day
= BCD_INT(Regs
.b
.dl
);
56 /* Some BIOSes leave CF unchanged if successful,
57 * so CF should be cleared before calling this function. */
58 __writeeflags(__readeflags() & ~EFLAGS_CF
);
61 * TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
64 * CF clear to avoid bug
66 * CF clear if successful
70 * DL = daylight savings flag (00h standard time, 01h daylight time)
71 * CF set on error (i.e. clock not running or in middle of update)
74 Int386(0x1A, &Regs
, &Regs
);
76 TimeInfo
.Hour
= BCD_INT(Regs
.b
.ch
);
77 TimeInfo
.Minute
= BCD_INT(Regs
.b
.cl
);
78 TimeInfo
.Second
= BCD_INT(Regs
.b
.dh
);