Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8622 | Boppan | 1 | #include |
2 | #include |
||
3 | |||
4 | struct tm buffertime; |
||
5 | |||
6 | struct tm * localtime (const time_t * timer) |
||
7 | /* non-standard! ignore parameter and return just time now */ |
||
8 | { |
||
9 | int kos_date, kos_time; |
||
10 | kos_date = _ksys_get_date(); |
||
11 | kos_time = _ksys_get_clock(); |
||
12 | |||
13 | int bcd_day = (kos_date >> 16); |
||
14 | int bcd_mon = ((kos_date & 0xFF00) >> 8); |
||
15 | int bcd_year = (kos_date & 0xFF); |
||
16 | buffertime.tm_mday = ((bcd_day & 0xF0)>>4)*10 + (bcd_day & 0x0F); |
||
17 | buffertime.tm_mon = ((bcd_mon & 0xF0)>>4)*10 + (bcd_mon & 0x0F) - 1; |
||
18 | buffertime.tm_year = ((bcd_year & 0xF0)>>4)*10 + (bcd_year & 0x0F) + 100; |
||
19 | |||
20 | buffertime.tm_wday = buffertime.tm_yday = buffertime.tm_isdst = -1; /* temporary */ |
||
21 | |||
22 | int bcd_sec = (kos_time >> 16); |
||
23 | int bcd_min = ((kos_time & 0xFF00) >> 8); |
||
24 | int bcd_hour = (kos_time & 0xFF); |
||
25 | |||
26 | buffertime.tm_sec = ((bcd_sec & 0xF0)>>4)*10 + (bcd_sec & 0x0F); |
||
27 | buffertime.tm_min = ((bcd_min & 0xF0)>>4)*10 + (bcd_min & 0x0F); |
||
28 | buffertime.tm_hour = ((bcd_hour & 0xF0)>>4)*10 + (bcd_hour & 0x0F); |
||
29 | |||
30 | return &buffertime; |
||
31 | } |
||
32 |