Example #1
0
static void print_event_timestamp(const event & evt)
{
  const time_t & evt_time = evt.get_time();

  char time_format_buffer[TIME_FORMAT_BUFF_SIZE];
  struct tm * tm_time = uflag ? gmtime(&evt_time) : localtime(&evt_time);

  string date =
    strftime(time_format_buffer,
             TIME_FORMAT_BUFF_SIZE,
             tformat.c_str(),
             tm_time) ? string(time_format_buffer) : string(_("<date format error>"));

  cout << date;
}
Example #2
0
void insert_event(list_events &events,event &x) {
  list_events::iterator it = events.begin(),end = events.end();
  while (it != end && x.get_time() > (*it)->get_time()) it++;
  events.insert(it,&x);
}