unix-time-to-fmt.py: fix crash without argument

Print "unknown" to stdout when unix-time-to-fmt.py was called without
an argument, instead of printing a Python stack trace to stderr. It gets
called that way when building outside of a git folder.

Change-Id: I3ba27cc23543e47cc8a1e494c35cc33f1dc8f297
This commit is contained in:
Oliver Smith 2018-11-08 13:39:03 +01:00
parent e65d9efb31
commit 10ffc82237
1 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,10 @@ Default is '%Y-%b-%d' --> 2016-Jan-01
import sys, time
if len(sys.argv) == 1:
print("unknown")
exit(0)
fmt = '%Y-%b-%d'
if len(sys.argv) > 2:
fmt = sys.argv[2]