Add aday, which converts build numbers to dates.

Change-Id: I8d4219f961951ef1d84d3027d361378005764ee6
This commit is contained in:
Dan Albert
2015-01-06 16:11:06 -08:00
parent 817e1ef487
commit 6313a60dc5

21
scripts/aday Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python
import datetime
import sys
def build_to_date(build):
letter = build[2]
day = int(build[3:5])
month = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.index(letter) * 3
year = 2009 + (month / 12)
month %= 12
return datetime.date(year, month + 1, 1) + datetime.timedelta(days=day - 1)
if __name__ == '__main__':
if len(sys.argv) != 2:
sys.exit('usage: aday BUILD_NUMBER')
print build_to_date(sys.argv[1])