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

version» Context lines:

pike.git/lib/modules/Val.pmod/module.pmod:782:       //! @returns    //! The same as @[localtime()], but augmented    //! by an extra member called @expr{nsec@}.    //! @seealso    //! @[localtime()]    public mapping(string:int) tm() {    return localtime((int)this) + (["nsec": nsecs % NANOSECONDS ]);    }    -  //! @seealso -  //! @[System.TM()->strftime()] -  public string(1..255) strftime(string(1..255) format) { -  return System.TM((int)this)->strftime(format); -  } -  -  //! @seealso -  //! @[System.TM()->strptime()] -  public bool strptime(string(1..255) format, string(1..255) data) { -  System.TM t = System.TM(); -  bool ret = t->strptime(format, data); -  if (ret) -  ::create(t->unix_time()); -  return ret; -  } -  +     //! 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",    t->year + 1900, t->mon+1, t->mday);    if (t->hour || t->min || t->sec || t->nsec)    res += " " + iso_time(t);
pike.git/lib/modules/Val.pmod/module.pmod:945:    || !zero_type(([object]that)->nsecs)    && days * 24 * 3600 * NANOSECONDS == [int]([object]that)->nsecs)    || intp(that) && (int)this == [int]that    || floatp(that) && (float)this == [float]that;    }       public mapping(string:int) tm() {    return gmtime((int)this);    }    -  //! @seealso -  //! @[System.TM()->strftime()] -  public string(1..255) strftime(string(1..255) format) { -  return System.TM((int)this)->strftime(format); -  } -  -  //! @seealso -  //! @[System.TM()->strptime()] -  public bool strptime(string(1..255) format, string(1..255) data) { -  System.TM t = System.TM(); -  bool ret = t->strptime(format, data); -  if (ret) -  create(t->unix_time()); -  return ret; -  } -  +     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);    }    case "float":    return (float)(int)this;    case "int":    return days * 24 * 3600;