Skip to content

Commit

Permalink
heatmap: epoch support
Browse files Browse the repository at this point in the history
  • Loading branch information
keenerd committed Dec 4, 2014
1 parent a4379b0 commit aa899f1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions heatmap/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def duration_parse(s):
return float(s) * suffix

def date_parse(s):
if '-' not in s:
return datetime.datetime.fromtimestamp(int(s))
return datetime.datetime.strptime(s, '%Y-%m-%d %H:%M:%S')

def gzip_wrap(path):
Expand Down Expand Up @@ -220,6 +222,8 @@ def slice_columns(columns, low_freq, high_freq):
high = int(line[3]) + args.offset_freq
step = float(line[4])
t = line[0] + ' ' + line[1]
if '-' not in line[0]:
t = line[0]

if args.low_freq is not None and high < args.low_freq:
continue
Expand Down Expand Up @@ -303,6 +307,8 @@ def collate_row(x_size):
#line = [line[0], line[1]] + [float(s) for s in line[2:] if s]
line = [s for s in line if s]
t = line[0] + ' ' + line[1]
if '-' not in line[0]:
t = line[0]
if t not in times:
continue # happens with live files and time cropping
if old_t is None:
Expand Down

0 comments on commit aa899f1

Please sign in to comment.