view m-toolbox/classes/+utils/@timetools/gps2utc.m @ 12:86aabb42dd84 database-connection-manager

Use utils.repository utilities
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% GPS2UTC converts GPS seconds to UTC time.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: GPS2UTC converts GPS seconds to UTC time.
%
% CALL:        UTC_time=GPS2UTC(GPS_time)
%
% FORMAT:      UTC time format: 'yyy-mm-dd- HH:MM:SS'
%              GPS time format: Seconds since 6. January 1980
%
%	EXAMPLES:    GPS_time=GPS2UTC(711129613)
%	             GPS_time='2002-07-19 16:00:00'
%
% VERSION:     $Id: gps2utc.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 UTC_time = gps2utc(GPS_time)

  leapSecond = 15;
  
  GPS_Epoch=datenum('01-06-1980 00:00:00')*86400;
  NUM_time=GPS_Epoch+GPS_time-leapSecond;

  UTC_time=datestr(NUM_time/86400,31);

end