<div dir="ltr">Here is an improvement over the provided script:<div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>class FullTimeHack</div></div><div><div>{</div></div><div><div>    int minutes;</div></div><div><div>    int seconds;</div></div><div><div><br></div></div><div><div>    // PRECONSTRUCTOR</div></div><div><div><br></div></div><div><div>    string datetime;</div></div><div><div>    ConsoleInput stdin;     // gonna read from here</div></div><div><div>    stdin.prompt(&quot;&quot;) =&gt; now; // wait until something comes in</div></div><div><div>    while (stdin.more())  {  stdin.getLine() =&gt; datetime;  } // read input</div></div><div><div>    //&lt;&lt;&lt; datetime &gt;&gt;&gt;;</div></div><div><div>    Std.atoi(datetime.substring(10, 2)) =&gt; minutes;</div></div><div><div>    Std.atoi(datetime.substring(13, 2)) =&gt; seconds;</div></div><div><div>    &lt;&lt;&lt; minutes + &quot;:&quot; + seconds &gt;&gt;&gt;;</div></div><div><div><br></div></div><div><div><br></div></div><div><div>    fun void print_full_time()</div></div><div><div>    {</div></div><div><div>        (seconds + now/second) % 60 =&gt; float new_seconds;</div></div><div><div>        (minutes + now/minute) $ int % 60 =&gt; int new_minutes;</div></div><div><div>        &lt;&lt;&lt; new_minutes + &quot;:&quot; + new_seconds &gt;&gt;&gt;;</div></div><div><div>    }</div></div><div><div><br></div></div><div><div>}</div></div><div><div><br></div></div><div><div>FullTimeHack hack;</div></div><div><div>hack.print_full_time();</div></div></blockquote><div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 2, 2016 at 6:11 PM, Chiel ten Brinke <span dir="ltr">&lt;<a href="mailto:ctenbrinke@gmail.com" target="_blank">ctenbrinke@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for you response. I&#39;m gonna try that out right away,<div><br></div><div>By the way, wouldn&#39;t it be nice if this could be done more easily? Especially since ChucK is really into all the timey wimey stuff :)</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 2, 2016 at 10:56 AM, Gonzalo <span dir="ltr">&lt;<a href="mailto:gonzalo@dense13.com" target="_blank">gonzalo@dense13.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I had a similar problem a while ago, Perry Cook suggested this, it might be of help:<br>
<br>
One way to do it would be to pass it in<br>
as an argument or other when you run ChucK.<br>
This example uses stdin to read the output<br>
of a &lt;date&gt; command in the shell:<br>
<br>
// TestDate.ck  Perry R. Cook, Dec. 2014<br>
ConsoleInput stdin;     // gonna read from here<br>
stdin.prompt(&quot;&quot;) =&gt; now; // wait until something comes in<br>
string datetime; // date and time<br>
string datetimenow; // plus time since chuck invoked tacked on<br>
while (stdin.more())  {  stdin.getLine() =&gt; datetime;  } // read input<br>
datetime.setCharAt(9,&#39;-&#39;); // replace time string colons<br>
datetime.setCharAt(12,&#39;-&#39;); // with dashes instead<br>
datetime+&quot;-&quot;+Std.ftoa(now/second,4) =&gt; datetimenow; // tack on time since chuck invoked<br>
&lt;&lt;&lt; datetimenow &gt;&gt;&gt;;<br>
// If you want to continue making updated unique<br>
// strings, just keep redoing the datetimenow line<br>
1.5*second =&gt; now;<br>
datetime+&quot;-&quot;+Std.ftoa(now/second,4) =&gt; datetimenow; // tack on time since chuck invoked<br>
&lt;&lt;&lt; datetimenow &gt;&gt;&gt;;<br>
<br>
To use this:<br>
<br>
date +&quot;%m%d%y-%T&quot; | chuck TestDate.ck<br>
<br>
Outputs (date-H-M-S-now):<br>
<br>
&quot;120614-15-00-09-0.0000&quot; : (string)<br>
&quot;120614-15-00-09-1.5000&quot; : (string)<div><div><br>
<br>
<br>
<br>
On 2/05/2016 9:53 AM, Chiel ten Brinke wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
I would like to figure out the source of latency from chuck interacting<br>
with another application via OSC. To do that, I want to print timestamps<br>
of messages sent and received and compare these.<br>
But here&#39;s the thing:<br>
<br>
How do I print the absolute current time in chuck? The variable `now`<br>
only seems to hold the time from the start of the process.<br>
<br>
<br></div></div>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br><span><font color="#888888">
</font></span></blockquote><span><font color="#888888">
<br>
-- <br>
<a href="http://dense13.com" rel="noreferrer" target="_blank">http://dense13.com</a><br>
<a href="http://www.whole-play.com" rel="noreferrer" target="_blank">http://www.whole-play.com</a><br>
<a href="https://www.30daygroove.com" rel="noreferrer" target="_blank">https://www.30daygroove.com</a><br>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>