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
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
28 PcRTCGetCurrentDateTime(PU32 Year
, PU32 Month
, PU32 Day
, PU32 Hour
, PU32 Minute
, PU32 Second
)
32 if (NULL
!= Year
|| NULL
!= Month
|| NULL
!= Day
)
34 /* Some BIOSes, such es the 1998/07/25 system ROM
35 * in the Compaq Deskpro EP/SB, leave CF unchanged
36 * if successful, so CF should be cleared before
37 * calling this function. */
41 * TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
44 * CF clear to avoid bug
46 * CF clear if successful
54 Int386(0x1A, &Regs
, &Regs
);
58 *Year
= 100 * BCD_INT(Regs
.b
.cl
) + BCD_INT(Regs
.b
.ch
);
62 *Month
= BCD_INT(Regs
.b
.dh
);
66 *Day
= BCD_INT(Regs
.b
.dl
);
70 if (NULL
!= Hour
|| NULL
!= Minute
|| NULL
!= Second
)
72 /* Some BIOSes leave CF unchanged if successful,
73 * so CF should be cleared before calling this function. */
77 * TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
80 * CF clear to avoid bug
82 * CF clear if successful
86 * DL = daylight savings flag (00h standard time, 01h daylight time)
87 * CF set on error (i.e. clock not running or in middle of update)
90 Int386(0x1A, &Regs
, &Regs
);
94 *Hour
= BCD_INT(Regs
.b
.ch
);
98 *Minute
= BCD_INT(Regs
.b
.cl
);
102 *Second
= BCD_INT(Regs
.b
.dh
);