Login
Artifact [447878e41c]
Login

Artifact 447878e41c8c2ef646c19f45e56182c7a480d35c:



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(l,r){
        affirm 'integer' === typename r;
        return (l===r) || (l===(r-1)) || (l===(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 */;
}