#! /bin/sh
# set -x
# "lldatimp" script returns converted current time with added 
# timeshift in minutes.
# If argument ($1) is entered, it's expected to be the time
# to add in minutes to the current time (=45 minutes by default).
#
# Example: lldatimp 60


OS=${OS:-`uname -s`}
if [ "$OS" != 'Linux' ] ; then
#exec ssh erg "lldatimp $*"
 exec ssh joule "lldatimp $*"
fi

if [ -n "$1" ] ; then
 T2add=`expr $1 \* 60`
else
 T2add=`expr 45 \* 60`
fi

TZ=UTC0; export TZ
# Time in seconds since 1/1/1970 Coordinated Universal Time (CUT).

Xts111970=`date -u '+%s'`

# Add "T2add" to it:

Xts111970p=`expr $Xts111970 + $T2add`

# Date/Time to return:

  DaTim2Rtrn=`/bin/date -u '+%D %H:%M:%S' -d@${Xts111970p}`
# DaTim2Rtrn=`/bin/date -u '+%m/%d/%Y %H:%M:%S' -d@${Xts111970p}`

echo "${DaTim2Rtrn}"
