[chuck-users] time goes backwards (and I don't like that)

Robert Poor rdpoor at gmail.com
Fri Mar 13 17:46:38 EDT 2009

I can make time go backwards.  Here's the file:
Event _e;
time _t;

spork ~ beatProcess();

while (true) {
     now + 1.00001::second => _t;
     _e => now;
     <<< "returned from _e => now at", now >>>;

fun void beatProcess() {
     while (true) {
	_t => now;
	<<< "broadcasting at", now >>>;
And here's the output:
bash-3.2$ chuck foo.ck
broadcasting at 44100.441000
returned from _e => now at 44100.000000
broadcasting at 88200.441000
returned from _e => now at 88200.000000
broadcasting at 132300.441000
returned from _e => now at 132300.000000
The "while(true)" shred sets _t to the time at which it wants to be  
woken up.  Note that (intentionally) the increment is slightly over a  
second.  It then blocks on event _e.

Meanwhile, the beatProcess() shred blocks until the time in _t, then  
triggers event _e to resume execution of the while(true) shred.

What happens:
- the beatProcess shred triggers _e at time 44100.441000
- the while() shred returns from its wait at time 44100.0000

One might think that the while(true) shred woke up *before* _e got  
triggered, but Apple isn't yet building computers with tachyon  
technology.  Can someone tell me what's really going on???  Failing  
that, know any doctors who will prescribe a selective serotonin  
reuptake inhibitor to keep me from tearing my hair out?


- Rob

More information about the chuck-users mailing list