mirror of https://github.com/nirenjan/dotfiles.git
				
				
				
			Add stardate script based on Julian date
							parent
							
								
									e376d0eca1
								
							
						
					
					
						commit
						cb88dd975e
					
				| 
						 | 
					@ -0,0 +1,15 @@
 | 
				
			||||||
 | 
					#!/usr/bin/env python
 | 
				
			||||||
 | 
					""" Calculate the Julian Date """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					t = time.time()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					""" Technically, we should be adding 2440587.5,
 | 
				
			||||||
 | 
					    however, since we are trying to stick to the stardate
 | 
				
			||||||
 | 
					    concept, we add only 440587.5"""
 | 
				
			||||||
 | 
					jd = t / 86400.0 + 440587.5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Use the idea that 10 Julian days is equal to 1 stardate
 | 
				
			||||||
 | 
					print "%05.1f" % (jd / 10)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue