| ... | ... |
@@ -384,7 +384,10 @@ static Uint8 |
| 384 | 384 |
datetime_dei(Device *d, Uint8 port) |
| 385 | 385 |
{
|
| 386 | 386 |
time_t seconds = time(NULL); |
| 387 |
+ struct tm zt = {0};
|
|
| 387 | 388 |
struct tm *t = localtime(&seconds); |
| 389 |
+ if(t == NULL) |
|
| 390 |
+ t = &zt; |
|
| 388 | 391 |
switch(port) {
|
| 389 | 392 |
case 0x0: return (t->tm_year + 1900) >> 8; |
| 390 | 393 |
case 0x1: return (t->tm_year + 1900); |