in reply to Converting to GPS time
local time = UTC + time offset, GPS = UTC without the correction for leap seconds.
So you can correct your local time for the time offset and forget about the leap seconds. Or even simpler use gmtime().
For example:
#!/usr/local/bin/perl use strict; use warnings; my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); my @weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun); my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfW +eek, $dayOfYear) = gmtime(); my $year = 1900 + $yearOffset; my $GMTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$mo +nth] $dayOfMonth, $year"; print $GMTime;
I wonder why you're not interested in the leap second correction as accuracy is normally quite important?!
Cheers
Harry
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting to GPS time
by scitash (Initiate) on Mar 05, 2010 at 08:39 UTC | |
by mrdvt92 (Acolyte) on Mar 06, 2011 at 00:20 UTC |