Use strftime to get ISO time format for valid ticket end time.
This commit is contained in:
parent
136e6687b8
commit
889fceaae0
@ -266,11 +266,19 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg, uint8_t payment_
|
|||||||
cout << "Total minutes: " << (int)ret_val << endl;
|
cout << "Total minutes: " << (int)ret_val << endl;
|
||||||
if (ret_val <= 0) return "PARKING NOT ALLOWED";
|
if (ret_val <= 0) return "PARKING NOT ALLOWED";
|
||||||
|
|
||||||
struct tm valid_until_datetime = *localtime(&valid_until_datetime_t);
|
struct tm valid_until_datetime = *localtime(&valid_until_datetime_t);
|
||||||
LOG_DEBUG("Ticket is valid until ", asctime(&valid_until_datetime));
|
// TEST: no daylight saving time
|
||||||
|
// valid_until_datetime.tm_isdst = 0;
|
||||||
|
|
||||||
|
char buf[128];
|
||||||
|
memset(buf, 0x00, sizeof(buf));
|
||||||
|
strftime(buf, sizeof(buf)-1, "%Y-%m-%dT%H:%M:%S", &valid_until_datetime);
|
||||||
|
|
||||||
|
// LOG_DEBUG("Ticket is valid until ", asctime(&valid_until_datetime));
|
||||||
|
LOG_DEBUG("Ticket is valid until ", buf);
|
||||||
|
|
||||||
total_duration_min = 0.0f;
|
total_duration_min = 0.0f;
|
||||||
return asctime(&valid_until_datetime);
|
return std::string(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user