| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

gmt_to_local

#include "sfldate.h"
void
gmt_to_local (long gmt_date, long gmt_time, long *date, long *time)

Synopsis

Converts the specified GMT date and time to the local time. Returns the local date and time in two arguments. If the supplied value is out of range, returns 00:00 on 1 January, 1970 (19700101).

Source Code - (sfldate.c)

{
    time_t
        time_value;
    struct tm
        *time_struct;

    /*  Convert from GMT                                                     */
    time_value  = date to timer (gmt_date, gmt_time) - TIMEZONE;
    time_struct = safe localtime (&time_value);
    if (time_struct-> tm_isdst)
      {
        time_value  += 3600;            /*  Adjust for daylight savings      */
        time_struct = localtime (&time_value);
      }
    time_struct-> tm_year += 1900;
    *date = MAKE_DATE (time_struct-> tm_year / 100,
                       time_struct-> tm_year % 100,
                       time_struct-> tm_mon + 1,
                       time_struct-> tm_mday);
    *time = MAKE_TIME (time_struct-> tm_hour,
                       time_struct-> tm_min,
                       time_struct-> tm_sec,
                       0);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation