Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@timetools/utc2gps.m @ 16:91f21a0aab35 database-connection-manager
Update utils.jquery
* * *
Update utils.jmysql.getsinfo
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% UTC2GPS Converts UTC time to GPS seconds. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: UTC2GPS Converts UTC time to GPS seconds. % UTC_time can also be an array of UTC times. % % CALL: GPS_time=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: utc2gps.m,v 1.2 2010/02/01 15:35:10 ingo Exp $ % % HISTORY: xx-xx-xxxx Karsten Koetter % Creation % 24-01-2007 M Hewitson. % Maintained % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function GPS_time = utc2gps(UTC_time) leapSecond = 15; GPS_Epoch=datenum('01-06-1980 00:00:00')*86400; [p q]=size(UTC_time); for i=1:p CurrUTC=UTC_time(i,:); % reformt string to stupid matlab format MM-DD-YYY CurrUTC=strcat(CurrUTC(6:10),'-',CurrUTC(1:4),CurrUTC(11:length(CurrUTC))); NUM_time=datenum(CurrUTC)*86400; GPS_time(i)=round(NUM_time-GPS_Epoch+leapSecond); end end