LTPDA_UTC2GPS Converts UTC time to GPS seconds. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: LTPDA_UTC2GPS Converts UTC time to GPS seconds. UTC_time can also be an array of UTC times. CALL: GPS_time=ltpda_UTC2GPS(UTC_time) FORMAT: UTC time format: 'yyy-mm-dd- HH:MM:SS' GPS time format: Seconds since 6. January 1980 EXAMPLES: GPS_time=UTC2GPS('2002-07-19 16:00:00') GPS_time=711129613 GPS_time=UTC2GPS(['2002-07-19 16:00:00';'2001-07-19 16:00:00']) GPS_time=[711129613 ; 679593613] VERSION: $Id: ltpda_utc2gps.html,v 1.14 2008/03/31 10:27:44 hewitson Exp $ HISTORY: xx-xx-xxxx Karsten Koetter Creation 24-01-2007 M Hewitson. Maintained %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function GPS_time=ltpda_utc2gps(UTC_time) 0002 % LTPDA_UTC2GPS Converts UTC time to GPS seconds. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: LTPDA_UTC2GPS Converts UTC time to GPS seconds. 0007 % UTC_time can also be an array of UTC times. 0008 % 0009 % CALL: GPS_time=ltpda_UTC2GPS(UTC_time) 0010 % 0011 % FORMAT: UTC time format: 'yyy-mm-dd- HH:MM:SS' 0012 % GPS time format: Seconds since 6. January 1980 0013 % 0014 % EXAMPLES: GPS_time=UTC2GPS('2002-07-19 16:00:00') 0015 % GPS_time=711129613 0016 % 0017 % GPS_time=UTC2GPS(['2002-07-19 16:00:00';'2001-07-19 16:00:00']) 0018 % GPS_time=[711129613 ; 679593613] 0019 % 0020 % VERSION: $Id: ltpda_utc2gps.html,v 1.14 2008/03/31 10:27:44 hewitson Exp $ 0021 % 0022 % HISTORY: xx-xx-xxxx Karsten Koetter 0023 % Creation 0024 % 24-01-2007 M Hewitson. 0025 % Maintained 0026 % 0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0028 0029 GPS_Epoch=datenum('01-06-1980 00:00:00')*86400; 0030 0031 [p q]=size(UTC_time); 0032 0033 for i=1:p 0034 CurrUTC=UTC_time(i,:); 0035 % reformt string to stupid matlab format MM-DD-YYY 0036 CurrUTC=strcat(CurrUTC(6:10),'-',CurrUTC(1:4),CurrUTC(11:length(CurrUTC))); 0037 NUM_time=datenum(CurrUTC)*86400; 0038 0039 GPS_time(i)=round(NUM_time-GPS_Epoch+14); 0040 end