Dear list,<br><br>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.<br><br>considder the following;<br><br>=================<br>time birth;
<br>now - (now /samp)::samp => time start;<br>if (start == birth) <<<"Yay">>>;<br>=============================<br><br>*hits head*<br><br>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.
<br><br>Next up; a poor man's casting;<br>=============================<br>//demo<br><<<dtot(second)>>>;<br><<<ttod(now)>>>;<br><br>//the meat<br>//time to duration and dur to time by Kassen.
<br>//considered trivial once I thought of it<br>//no rights reserved<br><br>fun time dtot (dur input)<br> {<br> //duration to time<br> //probably leaks memory<br> time garbage;<br> input +=> garbage;<br> return garbage;
<br> }<br><br><br>fun dur ttod (time input)<br> {<br> //time to duration<br> <br> //here we go again with the strong typing<br> return ( input/samp )::samp;<br> }<br><br>====================================<br><br>*hits head again*
<br><br>Cheers,<br>Kas.<br>