pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:52:   #define GET_ZONE(this) ((this)->t.tm_zone)   #define SET_GMTOFF(TM, VAL) (((TM)->tm_gmtoff) = (VAL))   #define SET_ZONE(this, VAL) ((this)->t.tm_zone = (VAL))   #elif defined(STRUCT_TM_HAS_GMTOFF)    struct tm_extra { };   #define GET_GMTOFF(TM) ((TM)->tm_gmtoff)   #define GET_ZONE(this) ((this)->t.tm_zone)   #define SET_GMTOFF(TM, VAL) (((TM)->tm_gmtoff) = (VAL))   #define SET_ZONE(this, VAL) ((this)->t.tm_zone = (VAL))   #else -  struct tm_extra { const char*tm_zone; }; +  struct tm_extra { const char *tm_zone; };   #define GET_GMTOFF(TM) 0   #define GET_ZONE(this) ((this)->extra.tm_zone)   #define SET_GMTOFF(TM, VAL) (VAL)   #define SET_ZONE(this, VAL) ((this)->extra.tm_zone = (VAL))   #endif      DECLARATIONS      /*! @module System    */
pike.git/src/builtin.cmod:86:   #define strftime_zone strftime   #define strptime_zone strptime   #define localtime_zone(X,Y) localtime(X)   #ifndef HAVE_EXTERNAL_TIMEZONE   #undef timezone   #endif      #define MODIFY(X) do{ THIS->modified = 1;THIS->t.X; }while(0)   #define FIX_THIS(fname) do { \    if(THIS->modified) \ -  fix_tm(fname, args, THIS); \ +  fix_tm(fname, THIS); \    } while(0)    - static void fix_tm(const char*fname, int args, struct TM_struct*this) + static void fix_tm(const char *fname, struct TM_struct *this)   {    const char*tm_zone = GET_ZONE(this);    int is_utc_zone = tm_zone && !strcmp(tm_zone, "UTC");    if (is_utc_zone)    this->t.tm_isdst = 0; -  this->unix_time = mktime_zone(fname, args, &this->t, is_utc_zone, 0); +  this->unix_time = mktime_zone(fname, &this->t, is_utc_zone, 0);    this->modified = 0;   }      #ifdef HAVE_STRPTIME    /*! @decl int(0..1) strptime( string(1..255) format, string(1..255) data )    *!    *! Parse the given @[data] using the format in @[format] as a date.    *!    *! @dl    *! @item %%
pike.git/src/builtin.cmod:582:    *! int(0..24) hour, int(0..59) min, int(0..59) sec, @    *! string|void timezone )    *! Construct a new time using the given values.    *! Slightly faster than setting them individually.    */    PIKEFUN void create( int year, int(0..11) mon, int(1..31) mday,    int(0..24) hour, int(0..59) min, int(0..59) sec,    string|void timezone )    {    struct tm *t = &THIS->t; -  int use_utc; -  t->tm_isdst = use_utc ? 0 : -1; +  int use_utc = 0; +  t->tm_isdst = -1;    t->tm_year = year - 1900;    t->tm_mon = mon;    t->tm_mday = mday;    t->tm_hour = hour;    t->tm_min = min;    t->tm_sec = sec; -  use_utc = 0; +     if (timezone) {    if (strcmp(timezone->str, "UTC"))    Pike_error("Timezone must either be UTC or omitted.\n");    use_utc = 1;    }    if (THIS->set_zone) {    free_string(THIS->set_zone);    THIS->set_zone = NULL;    }    if (use_utc)    t->tm_isdst = 0; -  THIS->unix_time = mktime_zone("TM", args, &THIS->t, use_utc, 0); +  THIS->unix_time = mktime_zone("TM", &THIS->t, use_utc, 0);    /* Setting it to other timezones than UTC is not supported (yet) */    if (use_utc)    SET_ZONE(THIS, "UTC");    }      #ifdef PIKE_NULL_IS_SPECIAL    INIT {    THIS->set_zone = 0;    THIS->modified = 0;    }