Sponsored Content
Full Discussion: UTC to GPS
Top Forums Shell Programming and Scripting UTC to GPS Post 303008191 by jiam912 on Wednesday 29th of November 2017 08:59:10 AM
Old 11-29-2017
RudiC,

yes u are right about the previous question ( 14 feb ).

As u can see at that time I have the GPStime and the issue was to change the UTC time -3hrs.

The actual case is complete different as i need to get the GPStime from UTC.

Hope u understand

I am trying my self the possibility to solve it.

Appreciate your help

---------- Post updated 11-29-17 at 08:59 AM ---------- Previous update was 11-28-17 at 09:49 AM ----------

RudiC

I get the output desired using this code
Code:
ts=$(date -d'01/06/1980 00:00:00' +%s)

lap=18

cat file |
	while read tt 
	do 
	dt=`echo $tt | awk '{print $1}' | awk -F"/" '{print $2"/"$3"/"$1}'`
	tm=`echo $tt | awk '{print substr($2,1,8)}'`
	ms=`echo $tt | awk '{print $2}' | awk -F":" '{print $NF}'`
	line=`echo $dt" " $tm`
	echo $line\ $(date -d "${line/// }" "+%s") | 
	awk '{print (($3 - '$ts') + '$lap')'$ms'}' 
	done


output

Code:
1195787648480000
1195787592380000
1195787697980000

Can u check if you can help me to do it in short code, please Smilie
 

10 More Discussions You Might Find Interesting

1. AIX

Utc

Is there an AIX command that displays the date mode so I can see if we have universal time code on? There's a vms command to tell you this but I have not been able to find a similar AIX command. (0 Replies)
Discussion started by: cchiang12
0 Replies

2. UNIX for Advanced & Expert Users

changing sys clock (PST to UTC)

Hi I'm trying to change my sys clock from PST to UTC. I've read the man date page it helpfully says :- -u, --utc, --universal print or set Coordinated Universal Time as root I have tried date --universal, date -u, date --utc, I have checked the /etc/sysinfo/clock file the... (5 Replies)
Discussion started by: OFFSIHR
5 Replies

3. Shell Programming and Scripting

Getting MAC from GPS unit

Never mind i got the answer thanks., (0 Replies)
Discussion started by: deaconf19
0 Replies

4. Shell Programming and Scripting

Converting timestamps to UTC in bash

Hello, I am trying to figure out a way to convert the timestamps in a dataset from one timezone (which has daylight savings) to UTC. 2009-02-25 23:57:22,000D60727B89,221.16.86.23,SYSTEM1What would be the best way to approach this? (3 Replies)
Discussion started by: hazno
3 Replies

5. Shell Programming and Scripting

Convert UTC time to Date

Hi, I need to convert a number representing time in UTC seconds to a date. Ex: 3BE0082C --> Oct 31 2001 15:31:08 I have tried the following perl command but it gives a different answer? $ perl -e 'print scalar localtime(shift), "\n"' 3BE00B2C Thu Jan 1 03:00:03 1970 Any ideas? Thanks. :) (10 Replies)
Discussion started by: GNMIKE
10 Replies

6. Shell Programming and Scripting

CST to UTC conversion

Hi ALL, In a file i have the date and time as: 2009-04-28 23:10:05 CST My Local Unix server time is in UTC. Now i need to convert the above date and time in the file to UTC timezone and convert to number of seconds. Kindly suggest me on this, ---------- Post updated at 05:13 AM... (6 Replies)
Discussion started by: HemaV
6 Replies

7. AIX

Convert time (YYYYMMDD HHMMSS) to UTC

Okay, so let's say we have a string like: 20110105_193345 This represents: January 5th, 2011 = 20110105 24-hour style time 19:33:45 = 193345 Okay, so we have our time. It's January 5th, 2011 at 19:33:45. I want to convert this time from Eastern Time Zone (which it currently is in)... (1 Reply)
Discussion started by: syndex
1 Replies

8. AIX

Change Time Zone to UTC without DST

Hello AIX friends, We have timezone settings on our AIX 6.1 boxes set to Europe/London. How can I change it to UTC timezone with Daylight saving disabled. After running "smit chtz_user" I don't see UTC option in the listing. Please advise. TIA (3 Replies)
Discussion started by: prvnrk
3 Replies

9. Shell Programming and Scripting

Converting timestamp from PST to UTC

I need to convert the given datetime from PST to UTC, i gone through multiple forum examples but everywhere it mentioned about converting the server datetime. So could someone help me on this. I will be getting arguments for my script in the format of yyyymmddhh (eg:2015101004 - it will be pst),... (4 Replies)
Discussion started by: close2jay
4 Replies

10. AIX

GPS Clock Not Synchronised

Hi guys, I got some error on my application server mentioning that gps clock not sync to my db server. what is the command to check is my server is sync with the gps clock? appreciate if you guys can let me know how to troubleshoot this problem. Thanks (1 Reply)
Discussion started by: leecopper
1 Replies
GPS::Point(3pm) 					User Contributed Perl Documentation					   GPS::Point(3pm)

NAME
GPS::Point - Provides an object interface for a GPS point. SYNOPSIS
use GPS::Point; my $obj=GPS::Point->newGPSD($GPSD_O_line);#e.g. GPSD,O=.... my $obj=GPS::Point->new( time => $time, #float seconds from the unix epoch lat => $lat, #signed degrees lon => $lon, #signed degrees alt => $hae, #meters above the WGS-84 ellipsoid speed => $speed, #meters/second (over ground) heading => $heading, #degrees clockwise from North climb => $climb, #meters/second etime => $etime, #float seconds ehorizontal => $ehz, #float meters evertical => $evert, #float meters espeed => $espeed, #meters/second eheading => $ehead, #degrees eclimb => $eclimb, #meters/second mode => $mode, #GPS mode [?=>undef,None=>1,2D=>2,3D=>3] tag => $tag, #Name of the GPS message for data ); DESCRIPTION
This is a re-write of Net::GPSD::Point with a goal of being more re-usable. GPS::Point - Provides an object interface for a GPS fix (e.g. Position, Velocity and Time). Note: Please use Geo::Point, if you want 2D or projection support. USAGE
print scalar($point->latlon), " "; #latlon in scalar context my ($x,$y,$z)=$point->ecef; #if Geo::ECEF is available my $GeoPointObject=$point->GeoPoint; #if Geo::Point is available my @distance=$point->distance($point2); #if Geo::Inverse is available my $distance=$point->distance($point2); #if Geo::Inverse->VERSION >=0.05 USAGE TODO
my $obj=GPS::Point->newNMEA($NMEA_lines); #e.g. GGA+GSA+RMC CONSTRUCTOR
new my $obj = GPS::Point->new(); newGPSD my $obj=GPS::Point->newGPSD($GPSD_O_line);#e.g. GPSD,O=.... newMulti Constructs a GPS::Point from a Multitude of arguments. Arguments can be a GPS::Point, Geo::Point, {lat=>$lat,lon=>$lon} (can be blessed), [$lat, $lon] (can be blessed) or a ($lat, $lon) pair. my $point=GPS::Point->newMulti( $lat, $lon, $alt ); #supports lat, lon and alt my $point=GPS::Point->newMulti([$lat, $lon, $alt]); #supports lat, lon and alt my $point=GPS::Point->newMulti({lat=>$lat, lon=>$lon, ...}); my $point=GPS::Point->newMulti(GPS::Point->new(lat=>$lat, lon=>$lon)); my $point=GPS::Point->newMulti(Geo::Point->new(lat=>$lat, long=>$lon, proj=>'wgs84')); my $point=GPS::Point->newMulti({latitude=>$lat, longtude=>$lon}); Note: Hash reference context supports the following keys lat, lon, alt, latitude, longitude, long, altitude, elevation, hae, elev. Note: Units are always decimal degrees for latitude and longitude and meters above the WGS-84 ellipsoid for altitude. initialize, initializeGPSD, initializeMulti METHODS (Base) time Sets or returns seconds since the Unix epoch, UTC (float, seconds) print $obj->time, " "; lat, latitude Sets or returns Latitude (float, degrees) print $obj->lat, " "; lon, long or longitude Sets or returns Longitude (float, degrees) print $obj->lon, " "; alt, altitude, hae, elevation Sets or returns Altitude (float, meters) print $obj->alt, " "; speed Sets or returns speed (float, meters/sec) print $obj->speed, " "; heading, bearing Sets or returns heading (float, degrees) print $obj->heading, " "; climb Sets or returns vertical velocity (float, meters/sec) print $obj->climb, " "; etime Sets or returns estimated timestamp error (float, seconds, 95% confidence) print $obj->etime, " "; ehorizontal Sets or returns horizontal error estimate (float, meters) print $obj->ehorizontal, " "; evertical Sets or returns vertical error estimate (float, meters) print $obj->evertical, " "; espeed Sets or returns error estimate for speed (float, meters/sec, 95% confidence) print $obj->espeed, " "; eheading Sets or returns error estimate for course (float, degrees, 95% confidence) print $obj->eheading, " "; eclimb Sets or returns Estimated error for climb/sink (float, meters/sec, 95% confidence) print $obj->eclimb, " "; mode Sets or returns the NMEA mode (integer; undef=>no mode value yet seen, 1=>no fix, 2=>2D, 3=>3D) print $obj->mode, " "; tag Sets or returns a tag identifying the last sentence received. For NMEA devices this is just the NMEA sentence name; the talker-ID portion may be useful for distinguishing among results produced by different NMEA talkers in the same wire. (string) print $obj->tag, " "; METHODS (Value Added) fix Returns either 1 or 0 based upon if the GPS point is from a valid fix or not. print $obj->fix, " "; At a minimum this method requires mode to be set. datetime Returns a DateTime object from time my $dt=$point->datetime; At a minimum this method requires time to be set. latlon, latlong Returns Latitude, Longitude as an array in array context and as a space joined string in scalar context my @latlon=$point->latlon; my $latlon=$point->latlon; At a minimum this method requires lat and lon to be set. setAltitude Sets altitude from USGS web service and then returns the GPS::Point object. This method is a wrapper around Geo::WebService::Elevation::USGS. my $point=GPS::Point->new(lat=>$lat, lon=>$lon)->setAltitude; $point->setAltitude; my $alt=$point->alt; At a minimum this method requires lat and lon to be set and alt to be undef. ecef Returns ECEF coordinates. This method is a warpper around Geo::ECEF. my ($x,$y,$z) = $point->ecef; my @xyz = $point->ecef; my $xyz_aref = $point->ecef; #if Geo::ECEF->VERSION >= 0.08 At a minimum this method requires lat and lon to be set. (alt of 0 is assumed by Geo::ECEF->ecef). GeoPoint Returns a Geo::Point Object in the WGS-84 projection. my $GeoPointObject = $point->GeoPoint; At a minimum this method requires lat and lon to be set. distance Returns distance in meters between the object point and the argument point. The argument can be any valid argument of newMulti constructor. This method is a wrapper around Geo::Inverse. my ($faz, $baz, $dist) = $point->distance($pt2); #Array context my $dist = $point->distance($lat, $lon); #if Geo::Inverse->VERSION >=0.05 At a minimum this method requires lat and lon to be set. track Returns a point object at the predicted location in time seconds assuming constant velocity. Using Geo::Forward calculation. my $new_point=$point->track($seconds); #default $point->heading my $new_point=$point->track($seconds => $heading); At a minimum this method requires lat and lon to be set. It might be very useful to have speed, heading and time set although they all default to zero. forward Returns a point object at the distance and heading using Geo::Forward calculations. my $point=$point->forward($dist); #default $point->heading my $point=$point->forward($dist => $heading); #meters => degrees At a minimum this method requires lat and lon to be set. It might be useful to have heading set although the default is zero. BUGS
Send to GPSD-DEV or GEO-PERL email lists SUPPORT
Try GPSD-DEV or GEO-PERL email lists AUTHOR
Michael R. Davis CPAN ID: MRDVT DavisNetworks.com account=>perl,tld=>com,domain=>michaelrdavis http://www.davisnetworks.com/ COPYRIGHT
This program is free software licensed under the... The BSD License The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
Geo::Point, Net::GPSD, Net::GPSD::Point, Geo::ECEF, Geo::Functions, Geo::Forward, Geo::Inverse, Geo::Distance, Geo::Ellipsoids, Geo::WebService::Elevation::USGS, DateTime perl v5.10.1 2010-01-30 GPS::Point(3pm)
All times are GMT -4. The time now is 06:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy