zeek/aux/broctl/bin/fmt-time
Robin Sommer 2b6ad76bd5 Creating a branch release/1.5 with the current 1.5.3 release code.
This is so that people working from the current stable version can
still start using git.
2011-03-09 15:26:01 -08:00

19 lines
359 B
Python

#! /usr/bin/env python
#
# Prints a Unix timestamp $1 in the format Bro uses for its rotation timestamps.
fmt="%y-%m-%d_%H.%M.%S" # From rotate-logs.bro
import sys
import time
if len(sys.argv) != 2:
print >>sys.stderr, "usage: fmt-time unix-timestamp"
sys.exit(1)
t = float(sys.argv[1])
print time.strftime(fmt, time.localtime(int(t)))