Skip to content

Commit

Permalink
Tidy up includes.
Browse files Browse the repository at this point in the history
  • Loading branch information
acaudwell committed Aug 5, 2013
1 parent c013a3b commit 5046ac7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
14 changes: 3 additions & 11 deletions src/formats/apache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "apache.h"
#include <time.h>

const char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug" , "Sep", "Oct", "Nov", "Dec" };
Regex apache_entry_start("^(?:[^ ]+ )?([^ ]+) +[^ ]+ +([^ ]+) +\\[(.*?)\\] +(.*)$");
Expand Down Expand Up @@ -43,10 +44,6 @@ bool ApacheCombinedLog::parseCommit(RCommit& commit) {

//get details
commit.username = matches[0];
//std::string user = matches[1];

//parse timestamp
struct tm time_str;

std::string request_str = matches[3];
std::string datestr = matches[2];
Expand All @@ -57,27 +54,22 @@ bool ApacheCombinedLog::parseCommit(RCommit& commit) {
return 0;
}

//parse timestamp
int day = atoi(matches[0].c_str());
int year = atoi(matches[2].c_str());
int hour = atoi(matches[3].c_str());
int minute = atoi(matches[4].c_str());
int second = atoi(matches[5].c_str());

// int zone = atoi(matches[7].c_str());
//negative timezone
// if(strcmp(matches[6].c_str(), "-")==0) {
// zone = -zone;
// }

int month=0;

for(int i=0;i<12;i++) {
if(matches[1] == months[i]) {
month=i;
break;
}
}

struct tm time_str;
time_str.tm_year = year - 1900;
time_str.tm_mon = month;
time_str.tm_mday = day;
Expand Down
4 changes: 0 additions & 4 deletions src/formats/apache.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
#define GOURCE_APACHE_H

#include <string>
#include <string.h>

#include <vector>
#include <time.h>

#include "commitlog.h"

Expand Down

0 comments on commit 5046ac7

Please sign in to comment.