Skip to content

Commit

Permalink
Add trailing zeros in timestamp python script to compilation time <10…
Browse files Browse the repository at this point in the history
… #bugfix
  • Loading branch information
spaceAngel committed Oct 15, 2022
1 parent 83e49f4 commit a485430
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion scripts/createTimestampFile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
from datetime import datetime

def trailingZero(value):
if (value < 10):
return "0{0}".format(value)
else:
return value

dt = datetime.now()
f = open("src/Environment/timestamp.h", "w")
data = str(datetime.timestamp(dt));
Expand All @@ -25,7 +31,14 @@
"#pragma once \n"
+ "#include <string.h> \n"
+ "char compilationCommit[10] = \"" + commit.strip() + "\"; \n"
+ "char compilationDate[20] = \"{0}-{1}-{2} {3}:{4}:{5}\"; \n".format(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second)
+ "char compilationDate[20] = \"{0}-{1}-{2} {3}:{4}:{5}\"; \n".format(
dt.year,
dt.month,
dt.day,
trailingZero(dt.hour),
trailingZero(dt.minute),
trailingZero(dt.second)
)

)

Expand Down

0 comments on commit a485430

Please sign in to comment.