Skip to content

File formatter.cpp

File List > benchmark > exporter > formatter.cpp

Go to the documentation of this file

#include "formatter.h"

namespace Argos {

lxw_datetime ExcelFormatter::convert_time_t_to_lxw(const time_t &raw_time) {
  struct tm *time_info;
  lxw_datetime datetime = {0, 0, 0, 0, 0, 0.0};

  time_info = localtime(&raw_time);

  if (time_info != NULL) {
    datetime.year = time_info->tm_year + 1900;
    datetime.month = time_info->tm_mon + 1;
    datetime.day = time_info->tm_mday;
    datetime.hour = time_info->tm_hour;
    datetime.min = time_info->tm_min;
    datetime.sec = (double)time_info->tm_sec;
  }

  return datetime;
}

} // namespace Argos