Package: gpsdatetime
gpsdatetime - Python GPS date/time management packageThis is a python library for GNSS date/time transformationsUsageInitialize gpsdatetime objectimportgpsdatetimeasgpstinit from current computer date/timet=gpst.gpsdatetime()init from modified julian datet=gpst.gpsdatetime(mjd=54605.678)init from GPS week and second of weekt=gpst.gpsdatetime(wk=1400,wsec=600700)init from usual time elementst=gpst.gpsdatetime(yyyy=2016,mon=1,dd=7,hh=3,min=5,sec=5)init from SINEX time stringt=gpst.gpsdatetime('16:004:46888')init from sinex date elementst=gpst.gpsdatetime(yyyy=2016,doy=004,dsec=45677)init from iso time stringt=gpst.gpsdatetime('16:01:04T03:05:05Z')init from RINEX time stringt=gpst.gpsdatetime('18 10  9 12 20 45.00000')ort=gpst.gpsdatetime('2018 10  9 12 20 45.00000')Update date/timeSeveral functions are provided in order to update date/time.FunctionParametersPurposejust_nowupdate from current date/timeymdhms_tyear, month, day+[hour/minute/second]update with dateyyyyddds_tyear, day-of-year, second-of-daygpswkd_tGPS week, day of weekgpswks_tGPS week, second of weekmjd_tmodified julian dayjd_tJulian daysnx_t'20:123:43200'update with Sinex time stringrinex_t'2018 10  9 12 20 45.00000'update with Rinex time stringiso_t'16:01:04T03:05:05Z'update with iso time stringtimestamp_t'10/Aug/2023:09:33:43 +0000'update with timestamp time stringTime calculationsadd 5 seconds (or substract 2s) to gpsdatetime object tt+=5t-=2add x days, hour, seconds to current objectt.add_day(x)t.add_h(y)t.add_s(z)test wether t is before t1 or notift<t1:print('t before t1')duration between two time objectst1=gpst.gpsdatetime()t2=gpst.gpsdatetime()Delta_t=t2-t1# result in secondsset t object to current date at 0h00t.day00()set t object to current week on sunday morning 0h00t.wk00()set t object to beginning of current hourt.h00()set t object to beginning of current minutet.m00()Get attributesAttributeDescriptionUnits1970seconds from 01-01-1970 à 0h00ZsecondmjdModified Julian Date (MJD = JD – 2400000.5)decimal daysjdJulian Datedecimal daysjd50Julian Date from J1950decimal dayswkGPS weekweek I4wsecseconds in GPS weekfloat [0..604800]yyyyyear (4 digits)year I4 [1902..2079]yyyear (2 digits)year (I2)monmonth numberI2  [1..12]ddday of monthI2 [1..31]hhhourI2 [0..24]minminuteI2 [0..60]secsecondI2 [0..60]doyday of year (DOY)I3 [1..366]wdday of week (DOW)I1 [0..6]dsecsecond of dayfloat [0..86400]dydecimal yearfloat [0..366]GMSTGreenwich Mean Sidereal Timedecimal hoursEQEQEquation of equinoxesdecimal hoursGASTGreenwich Aparent Sidereal Timedecimal hoursy=t.yyyy# y = 2020Print time stringsReturn iso time string :iso_t=t.st_iso_epoch()# 2020-10-01T12:00:26Zoriso_t=t.st_iso_epoch(2)# 2020-10-01T12:00:26.00ZReturn Ephem (https://pypi.org/project/ephem/) time string : 2020/10/01 12:00:26.0s=t.st_pyephem_epoch()Return Rinex time string : 2020 10 01 12 00 26.0000000s=t.st_rinex_epoch()Return Sinex time string : 20:010:43226s=t.st_snx_epoch()Return time stamps=t.st_timestamp_epoch()Print all date/time elementsprint(t)"""gpsdatetime (version 1.0.38)-----------------------------------------------------------------s1970 : 1677283200.000000YYYY_MM_DD : 2023/02/25HH:MM:SS : 00:00:00.000000000GPS week : 2250Day of week : 6 (SAT)Second of week : 518400.000000000Second of day : 0.000000000session : aModified Julian Date : 60000.000000Julian Date : 2460000.500000YYYY : 2023  DOY : 056GMST (dec. hour) : 10.306795GAST (dec. hour) : 10.306635Eq. of Equinoxes (dec. hour) : -0.000160-----------------------------------------------------------------"""InstallationInstallation is accomplished from the command line.From pypiuser@desktop$pip3 install gpsdatetimeFrom package source directoryuser@desktop:~/gpsdatetime$ python3 setup.py installlicenceCopyright (C) 2014-2023, Jacques Beilin / ENSG-GeomatiqueDistributed under terms of the CECILL-C licence.