MCPcopy Create free account
hub / github.com/SIPp/sipp / formatTime

Method formatTime

src/stat.cpp:1479–1515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1477} /* end of msToHHMMSSus */
1478
1479char* CStat::formatTime (struct timeval* P_tv, bool with_epoch)
1480{
1481 static char L_time [TIME_LENGTH];
1482 struct tm * L_currentDate;
1483
1484 // Get the current date and time
1485 L_currentDate = localtime ((const time_t *)&P_tv->tv_sec);
1486
1487 // Format the time
1488 if (L_currentDate == nullptr) {
1489 memset (L_time, 0, TIME_LENGTH);
1490 } else {
1491 if (with_epoch) {
1492 sprintf(L_time, "%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d.%06ld%s",
1493 L_currentDate->tm_year + 1900,
1494 L_currentDate->tm_mon + 1,
1495 L_currentDate->tm_mday,
1496 L_currentDate->tm_hour,
1497 L_currentDate->tm_min,
1498 L_currentDate->tm_sec,
1499 (long)P_tv->tv_usec,
1500 M_G_gmt_offset);
1501 } else {
1502 sprintf(L_time, "%4.4d-%2.2d-%2.2d\t%2.2d:%2.2d:%2.2d.%06ld\t%10.10ld.%06ld",
1503 L_currentDate->tm_year + 1900,
1504 L_currentDate->tm_mon + 1,
1505 L_currentDate->tm_mday,
1506 L_currentDate->tm_hour,
1507 L_currentDate->tm_min,
1508 L_currentDate->tm_sec,
1509 (long)P_tv->tv_usec,
1510 (long)P_tv->tv_sec, /* time_t is int on some bsds */
1511 (long)P_tv->tv_usec);
1512 }
1513 }
1514 return (L_time);
1515} /* end of formatTime */
1516
1517long CStat::computeDiffTimeInMs (struct timeval* tf, struct timeval* ti)
1518{

Callers 1

draw_stats_screenMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected