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

version» Context lines:

pike.git/lib/modules/Val.pmod/module.pmod:370:    //! Casting it to float and int return unix-time values.    //! @seealso    //! @[mktime()], @[gmtime()]    protected mixed cast(string to) {    switch (to) {    case "string":    return (nsecs < 0 ? "-" : "") + iso_time(tm());    case "float":    return nsecs / NANOSECONDS.0;    case "int": -  return (nsecs - (nsecs < 0 ? NANOSECONDS - 1 : 0)) / NANOSECONDS; +  return nsecs / NANOSECONDS;    default:    return UNDEFINED;    }    }       protected string _sprintf(int fmt, mapping(string:mixed) params) {    switch (fmt) {    case 's': return (string)this;    default: return sprintf(sprintf("%%*%c", fmt), params, 0);    }
pike.git/lib/modules/Val.pmod/module.pmod:859:    variant protected void create(this_program copy) {    days = [int]copy->days;    }    variant protected void create(Timestamp copy) {    days = copy->nsecs / (24 * 3600 * NANOSECONDS) - (copy->nsecs < 0);    }    variant protected void create(mapping(string:int) tm) {    create(mktime(tm + (["isdst":0, "timezone":0])));    }    variant protected void create(int unix_time) { -  days = (unix_time - (unix_time < 0 ? 24 * 3600 -1 : 0)) / (24 * 3600); +  days = unix_time / (24 * 3600);    }    variant protected void create(float unix_time) {    create((int)unix_time);    }    variant protected void create() {    }       protected mixed `+(mixed that) {    object n = this_program(this);    if (objectp(that)) {