Home > m > timetools > ltpda_utc2gps.m

ltpda_utc2gps

PURPOSE ^

GPS_time=ltpda_UTC2GPS(UTC_time)

SYNOPSIS ^

function GPS_time=ltpda_utc2gps(UTC_time)

DESCRIPTION ^

    GPS_time=ltpda_UTC2GPS(UTC_time)
    converts UTC time to GPS seconds
    UTC_time can also be an array of UTC times

    Examples:
    GPS_time=UTC2GPS('2002-07-19 16:00:00')
    will return GPS_time=711129613

    GPS_time=UTC2GPS(['2002-07-19 16:00:00';'2001-07-19 16:00:00'])
    will return GPS_time=[711129613 ; 679593613]

 Original by Karsten Koetter. Maintained by M Hewitson.

 $Id: ltpda_utc2gps.html,v 1.1 2007/06/08 14:15:11 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function GPS_time=ltpda_utc2gps(UTC_time)
0002 %    GPS_time=ltpda_UTC2GPS(UTC_time)
0003 %    converts UTC time to GPS seconds
0004 %    UTC_time can also be an array of UTC times
0005 %
0006 %    Examples:
0007 %    GPS_time=UTC2GPS('2002-07-19 16:00:00')
0008 %    will return GPS_time=711129613
0009 %
0010 %    GPS_time=UTC2GPS(['2002-07-19 16:00:00';'2001-07-19 16:00:00'])
0011 %    will return GPS_time=[711129613 ; 679593613]
0012 %
0013 % Original by Karsten Koetter. Maintained by M Hewitson.
0014 %
0015 % $Id: ltpda_utc2gps.html,v 1.1 2007/06/08 14:15:11 hewitson Exp $
0016 %
0017 
0018 
0019 GPS_Epoch=datenum('01-06-1980 00:00:00')*86400;
0020 
0021 [p q]=size(UTC_time);
0022 
0023 for i=1:p
0024     CurrUTC=UTC_time(i,:);
0025     % reformt string to stupid matlab format MM-DD-YYY
0026     CurrUTC=strcat(CurrUTC(6:10),'-',CurrUTC(1:4),CurrUTC(11:length(CurrUTC)));
0027     NUM_time=datenum(CurrUTC)*86400;
0028 
0029     GPS_time(i)=round(NUM_time-GPS_Epoch+14);
0030 end

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003