UTC to GPS


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UTC to GPS
# 1  
Old 11-28-2017
UTC to GPS

Gents,

Kindly can u help with this.

I would like to get GPS time from UTC

Input
Code:
17/11/27 03:13:50:480000
17/11/27 03:12:54:380000
17/11/27 03:14:39:980000

output desired.

Code:
17/11/27 03:13:50:480000 1195787648480000
17/11/27 03:12:54:380000 1195787592380000
17/11/27 03:14:39:980000 1195787697980000

Appreciate your support.

Smilie
# 2  
Old 11-28-2017
Any attempts / ideas / thoughts from your side? Do you have the conversion algorithms at hand?
This User Gave Thanks to RudiC For This Post:
# 3  
Old 11-28-2017
RudiC
I got it as Unix Time
Code:
date +%s -ud "17/11/27 03:13:50"

but i dont know how to convert as desired
# 4  
Old 11-28-2017
Quote:
While most clocks derive their time from Coordinated Universal Time (UTC), the atomic clocks on the satellites are set to GPS time (GPST; see the page of United States Naval Observatory). The difference is that GPS time is not corrected to match the rotation of the Earth, so it does not contain leap seconds or other corrections that are periodically added to UTC. GPS time was set to match UTC in 1980, but has since diverged. The lack of corrections means that GPS time remains at a constant offset with International Atomic Time (TAI) (TAI – GPS = 19 seconds). Periodic corrections are performed to the on-board clocks to keep them synchronized with ground clocks.
Basically there is a nineteen second difference. And every time a leap second is applied to UTC you have to increment that number: currently 19 seconds, so 19 -> 20.

UTC to GPS Time Correction - Knowledge Base English - QPS Confluence
These 3 Users Gave Thanks to jim mcnamara For This Post:
# 5  
Old 11-28-2017
Now this is becoming somewhat ridiculous, as on 14. Feb. 17 you yourself raised this question. What did people in here post their answers for?
These 3 Users Gave Thanks to RudiC For This Post:
# 6  
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
# 7  
Old 11-30-2017
Gents,

Kindly, can you help to improve this code to be faster .. with 50000 lines in my file this take a lot time.

I appreciate your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. Shell Programming and Scripting

Getting MAC from GPS unit

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

9. 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

10. 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
Login or Register to Ask a Question