pike.git / lib / modules / Val.pmod / module.pmod

version» Context lines:

pike.git/lib/modules/Val.pmod/module.pmod:784:    public mapping(string:int) tm() {    return localtime((int)this) + (["nsec": nsecs % NANOSECONDS ]);    }       //! When cast to string it returns an ISO formatted timestamp    //! that includes daylight-saving and timezone corrections.    protected mixed cast(string to) {    switch (to) {    case "string": {    mapping(string:int) t = tm(); -  string res = sprintf("%04d/%02d/%02d", +  string res = sprintf("%04d-%02d-%02d",    t->year + 1900, t->mon+1, t->mday);    if (t->hour || t->min || t->sec || t->nsec)    res += " " + iso_time(t);    return res + iso_timezone(t->timezone);    }    }    return ::cast(to);    }       protected string _sprintf(int fmt, mapping(string:mixed) params) {
pike.git/lib/modules/Val.pmod/module.pmod:810:      //! Lightweight date type. Stores internally in days since epoch.   //! Supports arithmetic with @[Interval], @[Timestamp], @[Time]   //! and @[TimeTZ] objects.   //! Cast it to @expr{int@} or @expr{float@} to obtain unix_time.   //! @seealso   //! @[Interval], @[Timestamp], @[Time], @[TimeTZ], @[Range]   class Date {    constant is_date = 1;    -  //! Since 1970/01/01 (epoch). +  //! Since 1970-01-01 (epoch).    int days;       array(int) _encode() {    return ({days});    }       void _decode(array(int) x) {    days = x[0];    }   
pike.git/lib/modules/Val.pmod/module.pmod:925:    }       public mapping(string:int) tm() {    return gmtime((int)this);    }       protected mixed cast(string to) {    switch (to) {    case "string": {    mapping(string:int) t = tm(); -  return sprintf("%04d/%02d/%02d", t->year + 1900, t->mon+1, t->mday); +  return sprintf("%04d-%02d-%02d", t->year + 1900, t->mon+1, t->mday);    }    case "float":    return (float)(int)this;    case "int":    return days * 24 * 3600;    default:    return UNDEFINED;    }    }       protected string _sprintf(int fmt, mapping(string:mixed) params) {    switch (fmt) {    case 'O': return sprintf("Date(%s)", (string)this);    case 's': return (string)this;    }    return sprintf(sprintf("%%*%c", fmt), params, 0);    }   }