ReactOS
0.4.16-dev-1025-gd3456f5
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
pcrtc.c
Go to the documentation of this file.
1
/*
2
* FreeLoader
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
#include <
freeldr.h
>
20
21
#define BCD_INT(bcd) (((bcd & 0xf0) >> 4) * 10 + (bcd &0x0f))
22
23
TIMEINFO
*
24
PcGetTime
(
VOID
)
25
{
26
static
TIMEINFO
TimeInfo;
27
REGS
Regs;
28
29
for
(;;)
30
{
31
/* Some BIOSes, such as 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. */
35
Regs.
x
.
eflags
= 0;
36
// __writeeflags(__readeflags() & ~EFLAGS_CF);
37
38
/* Int 1Ah AH=04h
39
* TIME - GET REAL-TIME CLOCK DATE (AT,XT286,PS)
40
*
41
* AH = 04h
42
* CF clear to avoid bug
43
* Return:
44
* CF clear if successful
45
* CH = century (BCD)
46
* CL = year (BCD)
47
* DH = month (BCD)
48
* DL = day (BCD)
49
* CF set on error
50
*/
51
Regs.
b
.
ah
= 0x04;
52
Int386
(0x1A, &Regs, &Regs);
53
54
if
(!
INT386_SUCCESS
(Regs))
continue
;
55
56
TimeInfo.
Year
= 100 *
BCD_INT
(Regs.
b
.
ch
) +
BCD_INT
(Regs.
b
.
cl
);
57
TimeInfo.
Month
=
BCD_INT
(Regs.
b
.
dh
);
58
TimeInfo.
Day
=
BCD_INT
(Regs.
b
.
dl
);
59
60
/* Some BIOSes leave CF unchanged if successful,
61
* so CF should be cleared before calling this function. */
62
Regs.
x
.
eflags
= 0;
63
// __writeeflags(__readeflags() & ~EFLAGS_CF);
64
65
/* Int 1Ah AH=02h
66
* TIME - GET REAL-TIME CLOCK TIME (AT,XT286,PS)
67
*
68
* AH = 02h
69
* CF clear to avoid bug
70
* Return:
71
* CF clear if successful
72
* CH = hour (BCD)
73
* CL = minutes (BCD)
74
* DH = seconds (BCD)
75
* DL = daylight savings flag (00h standard time, 01h daylight time)
76
* CF set on error (i.e. clock not running or in middle of update)
77
*/
78
Regs.
b
.
ah
= 0x02;
79
Int386
(0x1A, &Regs, &Regs);
80
81
if
(!
INT386_SUCCESS
(Regs))
continue
;
82
83
TimeInfo.
Hour
=
BCD_INT
(Regs.
b
.
ch
);
84
TimeInfo.
Minute
=
BCD_INT
(Regs.
b
.
cl
);
85
TimeInfo.
Second
=
BCD_INT
(Regs.
b
.
dh
);
86
87
break
;
88
}
89
return
&TimeInfo;
90
}
91
92
/* EOF */
freeldr.h
void
Definition:
nsiface.idl:2307
INT386_SUCCESS
#define INT386_SUCCESS(regs)
Definition:
pcbios.h:179
Int386
int __cdecl Int386(int ivec, REGS *in, REGS *out)
BCD_INT
#define BCD_INT(bcd)
Definition:
pcrtc.c:21
PcGetTime
TIMEINFO * PcGetTime(VOID)
Definition:
pcrtc.c:24
BYTEREGS::ch
unsigned char ch
Definition:
pcbios.h:138
BYTEREGS::dl
unsigned char dl
Definition:
pcbios.h:140
BYTEREGS::cl
unsigned char cl
Definition:
pcbios.h:137
BYTEREGS::ah
unsigned char ah
Definition:
pcbios.h:132
BYTEREGS::dh
unsigned char dh
Definition:
pcbios.h:141
DWORDREGS::eflags
unsigned long eflags
Definition:
pcbios.h:105
_TIMEINFO
Definition:
fw.h:10
_TIMEINFO::Month
USHORT Month
Definition:
fw.h:12
_TIMEINFO::Day
USHORT Day
Definition:
fw.h:13
_TIMEINFO::Minute
USHORT Minute
Definition:
fw.h:15
_TIMEINFO::Hour
USHORT Hour
Definition:
fw.h:14
_TIMEINFO::Second
USHORT Second
Definition:
fw.h:16
_TIMEINFO::Year
USHORT Year
Definition:
fw.h:11
REGS
Definition:
pcbios.h:159
REGS::x
DWORDREGS x
Definition:
pcbios.h:160
REGS::b
BYTEREGS b
Definition:
pcbios.h:163
boot
freeldr
freeldr
arch
i386
pc
pcrtc.c
Generated on Tue Apr 22 2025 06:02:59 for ReactOS by
1.9.6