← Back to team overview

graphite-dev team mailing list archive

Re: [Question #38090]: breakdown of the timestamp required for data input (for FAQ)?

 

Question #38090 on Graphite changed:
https://answers.launchpad.net/graphite/+question/38090

Lance Norskog posted a new comment:
My time format is (unfortunately) month/day/year hour:minute:second GMT.
This script had an off-by-one error with the month. Here is the version
that reads my format:

#!/usr/bin/perl

use Time::Local;

open(DATA, "logs10_date.gr");

foreach $line (<DATA>) {
  chomp $line;
  my($source, $value, $date, $time) = split(/\s+/, $line);
  my($hour, $minute, $second) = split(/:/,$time);
  my($month, $mday, $year) = split(/\//,$date);
  my $epoch_time = timegm($second, $minute, $hour, $mday, $month-1, $year);

  print "$source $value $epoch_time\n";
}

Otherwise, thank you for archiving this five-year-old conversation :)

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.