next up previous contents
Next: Matlab Interface: Gravitational Radiation Up: Time Standards: UTC, GPS, Previous: Function: gpstime()   Contents

Example: testutctime

0 This example program demonstrates functions utctime() and gpstime(), and shows the relationship between the UTC time and the number of seconds after a given time. It was used to generate parts of the Table [*], and shows exactly how the standard Unix C library function gmtime() is broken.

Here is some output:

C-time:          0 GPS Time -315964811  UTC: Thu Jan  1 00:00:00 1970 GPS: Thu Jan  1 00:00:00 1970 gmtime: Thu Jan  1 00:00:00 1970
C-time:          1 GPS Time -315964810  UTC: Thu Jan  1 00:00:01 1970 GPS: Thu Jan  1 00:00:01 1970 gmtime: Thu Jan  1 00:00:01 1970
C-time:          2 GPS Time -315964809  UTC: Thu Jan  1 00:00:02 1970 GPS: Thu Jan  1 00:00:02 1970 gmtime: Thu Jan  1 00:00:02 1970

C-time:   33350399 GPS Time -282614412  UTC: Thu Jan 21 23:59:59 1971 GPS: Thu Jan 21 23:59:59 1971 gmtime: Thu Jan 21 23:59:59 1971
C-time:   33350400 GPS Time -282614411  UTC: Thu Jan 21 23:59:60 1971 GPS: Thu Jan 21 23:59:60 1971 gmtime: Fri Jan 22 00:00:00 1971
C-time:   33350401 GPS Time -282614410  UTC: Fri Jan 22 00:00:00 1971 GPS: Fri Jan 22 00:00:00 1971 gmtime: Fri Jan 22 00:00:01 1971

C-time:   63071999 GPS Time -252892812  UTC: Fri Dec 31 23:59:58 1971 GPS: Fri Dec 31 23:59:58 1971 gmtime: Fri Dec 31 23:59:59 1971
C-time:   63072000 GPS Time -252892811  UTC: Fri Dec 31 23:59:59 1971 GPS: Fri Dec 31 23:59:59 1971 gmtime: Sat Jan  1 00:00:00 1972
C-time:   63072001 GPS Time -252892810  UTC: Fri Dec 31 23:59:60 1971 GPS: Fri Dec 31 23:59:60 1971 gmtime: Sat Jan  1 00:00:01 1972

C-time:   78796800 GPS Time -237168011  UTC: Fri Jun 30 23:59:58 1972 GPS: Fri Jun 30 23:59:58 1972 gmtime: Sat Jul  1 00:00:00 1972
C-time:   78796801 GPS Time -237168010  UTC: Fri Jun 30 23:59:59 1972 GPS: Fri Jun 30 23:59:59 1972 gmtime: Sat Jul  1 00:00:01 1972
C-time:   78796802 GPS Time -237168009  UTC: Fri Jun 30 23:59:60 1972 GPS: Fri Jun 30 23:59:60 1972 gmtime: Sat Jul  1 00:00:02 1972

C-time:   94694401 GPS Time -221270410  UTC: Sun Dec 31 23:59:58 1972 GPS: Sun Dec 31 23:59:58 1972 gmtime: Mon Jan  1 00:00:01 1973
C-time:   94694402 GPS Time -221270409  UTC: Sun Dec 31 23:59:59 1972 GPS: Sun Dec 31 23:59:59 1972 gmtime: Mon Jan  1 00:00:02 1973
C-time:   94694403 GPS Time -221270408  UTC: Sun Dec 31 23:59:60 1972 GPS: Sun Dec 31 23:59:60 1972 gmtime: Mon Jan  1 00:00:03 1973

C-time:  126230402 GPS Time -189734409  UTC: Mon Dec 31 23:59:58 1973 GPS: Mon Dec 31 23:59:58 1973 gmtime: Tue Jan  1 00:00:02 1974
C-time:  126230403 GPS Time -189734408  UTC: Mon Dec 31 23:59:59 1973 GPS: Mon Dec 31 23:59:59 1973 gmtime: Tue Jan  1 00:00:03 1974
C-time:  126230404 GPS Time -189734407  UTC: Mon Dec 31 23:59:60 1973 GPS: Mon Dec 31 23:59:60 1973 gmtime: Tue Jan  1 00:00:04 1974

C-time:  315964810 GPS Time         -1  UTC: Sat Jan  5 23:59:59 1980 GPS: Sat Jan  5 23:59:59 1980 gmtime: Sun Jan  6 00:00:10 1980
C-time:  315964811 GPS Time          0  UTC: Sun Jan  6 00:00:00 1980 GPS: Sun Jan  6 00:00:00 1980 gmtime: Sun Jan  6 00:00:11 1980
C-time:  315964812 GPS Time          1  UTC: Sun Jan  6 00:00:01 1980 GPS: Sun Jan  6 00:00:01 1980 gmtime: Sun Jan  6 00:00:12 1980

C-time:  784880276 GPS Time  468915465  UTC: Tue Nov 15 06:17:35 1994 GPS: Tue Nov 15 06:17:35 1994 gmtime: Tue Nov 15 06:17:56 1994
C-time:  784880277 GPS Time  468915466  UTC: Tue Nov 15 06:17:36 1994 GPS: Tue Nov 15 06:17:36 1994 gmtime: Tue Nov 15 06:17:57 1994
C-time:  784880278 GPS Time  468915467  UTC: Tue Nov 15 06:17:37 1994 GPS: Tue Nov 15 06:17:37 1994 gmtime: Tue Nov 15 06:17:58 1994

C-time:  911110676 GPS Time  595145865  UTC: Sun Nov 15 06:17:33 1998 GPS: Sun Nov 15 06:17:33 1998 gmtime: Sun Nov 15 06:17:56 1998
C-time:  911110677 GPS Time  595145866  UTC: Sun Nov 15 06:17:34 1998 GPS: Sun Nov 15 06:17:34 1998 gmtime: Sun Nov 15 06:17:57 1998
C-time:  911110678 GPS Time  595145867  UTC: Sun Nov 15 06:17:35 1998 GPS: Sun Nov 15 06:17:35 1998 gmtime: Sun Nov 15 06:17:58 1998
Author: Bruce Allen (ballen@dirac.phys.uwm.edu).
Comments: None.



Bruce Allen 2000-11-19