Dear list,
It turns out that for a VM that has been running for a arbitrarily long time it's still easy to find the time of it's birth.
considder the following;
=================
time birth;
now - (now /samp)::samp => time start;
if (start == birth) <<<"Yay">>>;
=============================
*hits head*
So, it's possible after all to define objects of type time wthout using time after all; adding durations to a "fresh" time object will in fact do.
Next up; a poor man's casting;
=============================
//demo
<<<dtot(second)>>>;
<<<ttod(now)>>>;
//the meat
//time to duration and dur to time by Kassen.
//considered trivial once I thought of it
//no rights reserved
fun time dtot (dur input)
{
//duration to time
//probably leaks memory
time garbage;
input +=> garbage;
return garbage;
}
fun dur ttod (time input)
{
//time to duration
//here we go again with the strong typing
return ( input/samp )::samp;
}
====================================
*hits head again*
Cheers,
Kas.