| 1334 | } |
| 1335 | |
| 1336 | lbug_state lbug_date_to_tm(lbug_date_t date, struct tm* out_result) { |
| 1337 | time_t time = date.days * 86400; |
| 1338 | #ifdef _WIN32 |
| 1339 | if (convertTimeToTm(time, out_result) != 0) { |
| 1340 | return LbugError; |
| 1341 | } |
| 1342 | #else |
| 1343 | if (gmtime_r(&time, out_result) == nullptr) { |
| 1344 | return LbugError; |
| 1345 | } |
| 1346 | #endif |
| 1347 | out_result->tm_hour = 0; |
| 1348 | out_result->tm_min = 0; |
| 1349 | out_result->tm_sec = 0; |
| 1350 | return LbugSuccess; |
| 1351 | } |
| 1352 | |
| 1353 | lbug_state lbug_date_from_tm(struct tm tm, lbug_date_t* out_result) { |
| 1354 | #ifdef _WIN32 |