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
In reply to Re: Converting to GPS time
by dHarry
in thread Converting to GPS time
by scitash
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |