Converting a *future* time in another timezone to local time ...

Converting a *future* time in another timezone to local time ...

Post by Mark Jam » Thu, 28 Jul 1994 00:18:20



I am developing some voice mail scripts for use under Linux.
One program schedules the delivery of voice messages.
To make this work properly across timezones I need to convert
a future (scheduled) time expressed in another zone into local time.

The only way I can see of doing this easily is to do something like:

        LOCAL_SAVE=`date`
        TZ=<remote zone> date -s <REMOTE_TIME>
        LOCAL_TIME=`TZ=localtime date +FORMAT`
        date -s <LOCAL_SAVE>

But this changes the system's time for an instant -- not at all nice.

My current method uses a fixed timzone offset calculated at the
current time.  This of course will make scheduling inaccurate around
time discontinuities.

Is there any way to do what I want without having to hack some C code;
and if I have to write some C, what is the best way to go about it.

Thanks for your help,


Basser Department of Computer Science, F09   |  PHONE : +61-2-692-4276   |
The University of Sydney NSW 2006 AUSTRALIA  |  FAX   : +61-2-692-3838   |

 
 
 

Converting a *future* time in another timezone to local time ...

Post by Paul Egge » Fri, 29 Jul 1994 08:09:37



> Is there any way to do what I want without having to hack some C code;

Probably not.

Quote:> and if I have to write some C, what is the best way to go about it.

The most portable way is to use putenv("TZ=..."), tzset, mktime, and
localtime in the proper order.  This is ugly, since it relies on global
state in your C program, but doing it right will mean you'll have to do
a lot of hacking yourself.

 
 
 

1. convert UT time in local time / local time in UT time

hello,

    I try to make a fonction to convert a local time in UT time. i try to
use
     mktime + gmtime + timezone + daylight.... but the result is not OK.
    Please help me....
    The problem is the same when i try to convert a UT time in Local
Time....

    my imput date format is : 'YYYYMMDDHHMMSS'.

    I'am a beginner on Unix (and in english).....

    Does anyone know about a function or an example (in C) .

    Thanks for any help.

2. Booting from arbitrary hard drives

3. Convert local time to gmt time without using TimeZone Env variable

4. 3.1-RELEASE, STABLE & CURRENT Boot Disk Problems.

5. Automating package updates for large-scale RedHat Linux clusters

6. time time time how can I tell the time

7. The URL changes (Apache 1.3)

8. ??? UNIX tick time of future or past date/time

9. Converting Unix time to Normal time

10. How to convert time/date info into unix clock time

11. Time routine for ksh to convert to unix time.

12. converting date and time to unix time