mirror of https://github.com/nirenjan/dotfiles.git
20 lines
435 B
Python
Executable File
20 lines
435 B
Python
Executable File
#!/usr/bin/env python
|
|
""" Calculate the Julian Date """
|
|
# http://www.cs.utsa.edu/~cs1063/projects/Spring2011/Project1/jdn-explanation.html
|
|
|
|
import time
|
|
|
|
t = time.gmtime()
|
|
|
|
a = (14 - t.tm_mon) / 12
|
|
y = t.tm_year + 4800 - a
|
|
m = t.tm_mon + 12 * a - 3
|
|
|
|
jdn = t.tm_mday + (153 * m + 2) / 5 + 365 * y +\
|
|
y / 4 - y / 100 + y / 400 - 32045
|
|
|
|
jd = jdn + (t.tm_hour - 12) / 24.0 + t.tm_min / 1440.0 + t.tm_sec / 86400
|
|
|
|
print "%05.1f" % jd
|
|
|