| 214 | ////////////////////////////////////////////////////////////////////////// |
| 215 | |
| 216 | const shared_str InventoryUtilities::GetTimeAsString(ALife::_TIME_ID time, ETimePrecision timePrec, char timeSeparator) |
| 217 | { |
| 218 | string64 bufTime{}; |
| 219 | |
| 220 | u32 year = 0, month = 0, day = 0, hours = 0, mins = 0, secs = 0, milisecs = 0; |
| 221 | |
| 222 | split_time(time, year, month, day, hours, mins, secs, milisecs); |
| 223 | |
| 224 | // Time |
| 225 | switch (timePrec) |
| 226 | { |
| 227 | case etpTimeToHours: sprintf_s(bufTime, "%02i", hours); break; |
| 228 | case etpTimeToMinutes: sprintf_s(bufTime, "%02i%c%02i", hours, timeSeparator, mins); break; |
| 229 | case etpTimeToSeconds: sprintf_s(bufTime, "%02i%c%02i%c%02i", hours, timeSeparator, mins, timeSeparator, secs); break; |
| 230 | case etpTimeToMilisecs: sprintf_s(bufTime, "%02i%c%02i%c%02i%c%02i", hours, timeSeparator, mins, timeSeparator, secs, timeSeparator, milisecs); break; |
| 231 | case etpTimeToSecondsAndDay: { |
| 232 | int total_day = (int)(time / (1000 * 60 * 60 * 24)); |
| 233 | sprintf_s(bufTime, sizeof(bufTime), "%dd %02i%c%02i%c%02i", total_day, hours, timeSeparator, mins, timeSeparator, secs); |
| 234 | break; |
| 235 | } |
| 236 | default: R_ASSERT(!"Unknown type of date precision"); |
| 237 | } |
| 238 | |
| 239 | return bufTime; |
| 240 | } |
| 241 | |
| 242 | const shared_str InventoryUtilities::GetDateAsString(ALife::_TIME_ID date, EDatePrecision datePrec, char dateSeparator) |
| 243 | { |
nothing calls this directly
no test coverage detected