Re: [Jack-Devel] jack_get_Time() used CLOCK

PrevNext  Index
DateWed, 27 Feb 2013 11:03:18 +0100
From Christoph Pregla <[hidden] at uni-jena dot de>
To[hidden] at lists dot jackaudio dot org
In-Reply-ToJohn Emmas Re: [Jack-Devel] jack_get_Time() used CLOCK
Am 23.02.2013 12:43, schrieb John Emmas:
> On 23/02/2013 10:24, Christoph Pregla wrote:
>> sorry for my bad English grammar. Instead of CLOCK_MONOTONIC
>> I want CLOCK_REALTIME to be used for the method jack_get_time().
>> How can I implement this?
>> Or is it possible to adjust only the code in time.c of libjack?
>>
>
> If you want to create a time-of-day-clock you can achieve that by
> snapshotting the system time (and the Jack time) when you first run
> Jack (or when you first start your clock display).  You can snapshot
> the system time using the 'time()' function or something similar. All
> you need to do then is to work out the elapsed Jack time (by deducting
> the initial Jack time from the current Jack time).  Then just add the
> elapsed time to the system time that you obtained in the first place. 
> You can then convert the result to 'time-of-day' using 'localtime()'.
>
> It's only accurate to the nearest second but for a time-of-day clock
> that's usually all you want.  Of course, you could get better accuracy
> by dealing with remainders when you process your time calculations.
>
OK, the basic idea is not bad. I will think about it and consider like,
besides, I can achieve a high accuracy (miliseconds).

Regards,
Christoph
PrevNext  Index

1361959405.12841_0.ltw:2, <512DD9E6.2050304 at uni-jena dot de>