Login
Artifact [9cde80b3ed]
Login

Artifact 9cde80b3ed898dcba8337d40abb994b4039b8353:



scope {
    const tm = Fossil.time;
    var n = tm.now();
    var j = tm.unixToJulian(n);
    //print(n, tm.julianToUnix(j));
    //assert n === tm.julianToUnix(j) /* sometimes fails on rounding errors! Soo.... */;
    0.prototype.'operator=~' = proc(r){
        affirm 'integer' === typename r;
        return (this===r) || (this===(r-1)) || (this===(r+1));
    };
    assert n =~ tm.julianToUnix(j) /* round-trip sometime rounds badly, so we check for a +/-1 match */;
    unset n.prototype.'operator=~' /* avoid polluting downstream script code */;
    assert 19 === tm.julianToISO8601(j).length() /* w/o ms */;
    assert 23 === tm.julianToISO8601(j,true).length() /* w/ ms */;
}