| Well, this is the code that is called from
the opcode. It will never return a long
integer as the manual states (timeResolutionSeconds
is generally of the order 0.00001 on sane systems).
PUBLIC double csoundGetRealTime(RTCLOCK *p)
{
return ((double) (get_real_time() - p->starttime_real)
* (double) timeResolutionSeconds);
}
One thing it will never do is give you the time since 1970,
because it is being subtracted from the start time. On
all systems.
Victor
> I'm looking at the code and it seems that the function
> that rtclock opcode calls and the one that one
> subsequently calls has comments about resolution on Win95.
> The time resolution stuff in this code is all very
> strange. (This is all in Top/csound.c). It seems to be
> coded in a way such that depending on what you have
> available on your system, rtclock may report results in
> seconds or microseconds.
>
> Now, in this code is a check for HAVE_RDTSC which I have
> not seen in the codebase before. I don't know if that is a
> symbol automatically defined by systems or if that is
> something that is supposed to be checked by SConstruct and
> passed in.
>
> Hopefully someone else could shed some light on the topic!
> steven
>
>
> On 9/8/07, Victor Lazzarini
> > wrote: I reckon the man is wrong. On Windows I am
> > getting similar results to yours.
> >
> > Victor
> >
> > >
> > >
> > > hi -
> > >
> > > i tested the manual example for rtclock ...
> > >
> > > instr 1
> > > ; Get the system time.
> > > k1 rtclock
> > > ; Print it once per second.
> > > printk 1, k1
> > > endin
> > >
> > > ; Play Instrument #1 for two seconds.
> > > i 1 0 2
> > > e
> > >
> > > ..and expected something like this (from the manual
> > > example)
> > >
> > > i 1 time 0.00002: 1018236096.00000
> > > i 1 time 1.00002: 1018236224.00000
> > >
> > >
> > > but i get with output to dac:
> > >
> > > i 1 time 0.00002: 0.01464
> > > i 1 time 1.00000: 1.01257
> > > i 1 time 2.00000: 2.01394
> > >
> > > and with output to file:
> > >
> > > i 1 time 0.00002: 0.09404
> > > i 1 time 1.00000: 0.27993
> > > i 1 time 2.00000: 0.33443
> > >
> > > so it seems to give cpu time, right? is this the
> > > correct behavior for rtclock, or is this a bug (at
> > > least under os x)? is there an other way of getting
> > > the universal time in seconds?
> > >
> > > thanks for help -
> > >
> > > joachim
> > >
> > --
> > Send bugs reports to this list.
> > To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk > |