time conversion

My local server is in UTC time whereas my remote server in in CST time.
I get a sequential file from CST time server and the records in will contain the first line as a filename and the second line as date time like mentioned below.
/abc/cde/f1.txt
2009-04-28 23:10:05 CST

Now i need to convert the above time into seconds from the file time value and give a sleep command.
how to do the conversion.

Please give me suggestion on the same,

Do you want to convert "2009-04-28 23:10:05" into number of seconds since epoch ?

tyler_durden

If you want to know the delta between the file time and your server in seconds, the following should work. However it requires the use of ksh93.

servertime="2009-04-29 05:12:05 UTC"
filetime="2009-04-28 23:10:05 CST"
difftime=$(( $(printf "%(%s)T" "$server") - $(printf "%(%s)T" "$filetime") ))
echo $difftime

The output is 120

+ servertime=2009-04-29 05:12:05 UTC
+ filetime=2009-04-28 23:10:05 CST
+ + printf %(%s)T 2009-04-29 05:12:05 UTC
+ printf %(%s)T 2009-04-28 23:10:05 CST
h4.sh[5]: ()T - ()T : syntax error