pike.git
/
src
/
builtin.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/builtin.cmod:73:
/*! @class TM *! A wrapper for the system struct tm time keeping structure. *! This can be used as a (very) lightweight alternative to Calendar. */ PIKECLASS TM { CVAR struct tm t; CVAR time_t unix_time; CVAR int modified;
-
CVAR struct pike_string *set_zone;
+
CVAR struct tm_extra extra; #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)
pike.git/src/builtin.cmod:503:
} /*! @decl int gmtoff *! The offset from GMT for the time in this tm-struct */ PIKEFUN int `gmtoff() { FIX_THIS("gmtoff"); push_int( GET_GMTOFF(&(THIS->t)) ); }
-
/* Setting the zone does not work, so.. */
-
-
/* PIKEFUN string `zone=(string x) { */
-
/* if( THIS->set_zone ) */
-
/* free_string( THIS->set_zone ); */
-
/* THIS->set_zone = x; */
-
/* MODIFY( tm_zone = x->str ); */
-
/* x->refs++; */
-
/* } */
-
+
/*! @decl int(0..1) localtime( int time ) *! Initialize the struct tm to the local time for the specified *! unix time_t. */ PIKEFUN int(0..1) localtime( int _t ) { time_t t = _t; struct tm *res = localtime_zone( &t, &THIS->t ); if( !res ) RETURN 0;
pike.git/src/builtin.cmod:595:
t->tm_mon = mon; t->tm_mday = mday; t->tm_hour = hour; t->tm_min = min; t->tm_sec = sec; 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", &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; } #endif
-
-
EXIT
-
gc_trivial;
-
{
-
if( THIS->set_zone )
-
free_string( THIS->set_zone );
+
}
-
}
+
/*! @endclass */ #undef FIX_THIS #ifdef STRUCT_TM_HAS___TM_GMTOFF #undef tm_zone #undef tm_gmtoff #endif /*! @endmodule */