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

PrevNext  Index
DateSat, 23 Feb 2013 11:43:10 +0000
From John Emmas <[hidden] at tiscali dot co dot uk>
To[hidden] at lists dot jackaudio dot org
In-Reply-ToChristoph Pregla Re: [Jack-Devel] jack_get_Time() used CLOCK
Follow-UpChristoph Pregla Re: [Jack-Devel] jack_get_Time() used CLOCK
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.

John
PrevNext  Index

1361619801.13032_0.ltw:2,a <5128AB4E.6020506 at tiscali dot co dot uk>