PCem
view src/win-time.c @ 154:d0d530adce12
Initial port to Linux (using Allegro).
64-bit fixes.
Some changes to aid portability.
A few other tweaks.
| author | TomW |
|---|---|
| date | Thu Sep 04 21:07:24 2014 +0100 |
| parents | |
| children |
line source
1 #include <windows.h>
2 #include "ibm.h"
3 #include "nvr.h"
5 void time_get(char *nvrram)
6 {
7 SYSTEMTIME systemtime;
8 int c, d;
9 uint8_t baknvr[10];
11 memcpy(baknvr,nvrram,10);
12 GetLocalTime(&systemtime);
14 d = systemtime.wSecond % 10;
15 c = systemtime.wSecond / 10;
16 nvrram[0] = d | (c << 4);
17 d = systemtime.wMinute % 10;
18 c = systemtime.wMinute / 10;
19 nvrram[2] = d | (c << 4);
20 d = systemtime.wHour % 10;
21 c = systemtime.wHour / 10;
22 nvrram[4] = d | (c << 4);
23 d = systemtime.wDayOfWeek % 10;
24 c = systemtime.wDayOfWeek / 10;
25 nvrram[6] = d | (c << 4);
26 d = systemtime.wDay % 10;
27 c = systemtime.wDay / 10;
28 nvrram[7] = d | (c << 4);
29 d = systemtime.wMonth % 10;
30 c = systemtime.wMonth / 10;
31 nvrram[8] = d | (c << 4);
32 d = systemtime.wYear % 10;
33 c = (systemtime.wYear / 10) % 10;
34 nvrram[9] = d | (c << 4);
35 if (baknvr[0] != nvrram[0] ||
36 baknvr[2] != nvrram[2] ||
37 baknvr[4] != nvrram[4] ||
38 baknvr[6] != nvrram[6] ||
39 baknvr[7] != nvrram[7] ||
40 baknvr[8] != nvrram[8] ||
41 baknvr[9] != nvrram[9])
42 nvrram[0xA]|=0x80;
43 }
