Use strftime to get ISO time format for valid ticket end time.
This commit is contained in:
		@@ -266,11 +266,19 @@ std::string Calculator::GetDurationFromCost(Configuration* cfg, uint8_t payment_
 | 
			
		||||
	cout << "Total minutes: " << (int)ret_val << endl;
 | 
			
		||||
	if (ret_val <= 0) return "PARKING NOT ALLOWED";
 | 
			
		||||
 | 
			
		||||
	struct tm valid_until_datetime = *localtime(&valid_until_datetime_t);
 | 
			
		||||
	LOG_DEBUG("Ticket is valid until ", asctime(&valid_until_datetime));
 | 
			
		||||
    struct tm valid_until_datetime = *localtime(&valid_until_datetime_t);
 | 
			
		||||
    // 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;
 | 
			
		||||
	return asctime(&valid_until_datetime);
 | 
			
		||||
    return std::string(buf);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user