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.
22 #define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
25 PcRTCGetCurrentDateTime(PULONG Year
, PULONG Month
, PULONG Day
, PULONG Hour
, PULONG Minute
, PULONG Second
)
29 if (NULL
!= Year
|| NULL
!= Month
|| NULL
!= Day
)
31 /* Some BIOSes, such es the 1998/07/25 system ROM
32 * in the Compaq Deskpro EP/SB, leave CF unchanged
33 * if successful, so CF should be cleared before
34 * calling this function. */
38 * TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
41 * CF clear to avoid bug
43 * CF clear if successful
51 Int386(0x1A, &Regs
, &Regs
);
55 *Year
= 100 * BCD_INT(Regs
.b
.ch
) + BCD_INT(Regs
.b
.cl
);
59 *Month
= BCD_INT(Regs
.b
.dh
);
63 *Day
= BCD_INT(Regs
.b
.dl
);
67 if (NULL
!= Hour
|| NULL
!= Minute
|| NULL
!= Second
)
69 /* Some BIOSes leave CF unchanged if successful,
70 * so CF should be cleared before calling this function. */
74 * TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
77 * CF clear to avoid bug
79 * CF clear if successful
83 * DL = daylight savings flag (00h standard time, 01h daylight time)
84 * CF set on error (i.e. clock not running or in middle of update)
87 Int386(0x1A, &Regs
, &Regs
);
91 *Hour
= BCD_INT(Regs
.b
.ch
);
95 *Minute
= BCD_INT(Regs
.b
.cl
);
99 *Second
= BCD_INT(Regs
.b
.dh
);