rtc: allocate samples dynamically
This commit is contained in:
parent
75fd327222
commit
4963b931d0
1 changed files with 10 additions and 3 deletions
13
rtc_linux.c
13
rtc_linux.c
|
@ -86,8 +86,8 @@ static int skip_interrupts;
|
||||||
measured, together with a 'trim' that compensates these values for
|
measured, together with a 'trim' that compensates these values for
|
||||||
any steps made to the RTC to bring it back into line
|
any steps made to the RTC to bring it back into line
|
||||||
occasionally. The trim is in seconds. */
|
occasionally. The trim is in seconds. */
|
||||||
static time_t rtc_sec[MAX_SAMPLES];
|
static time_t *rtc_sec = NULL;
|
||||||
static double rtc_trim[MAX_SAMPLES];
|
static double *rtc_trim = NULL;
|
||||||
|
|
||||||
/* Reference time, against which delta times on the RTC scale are measured */
|
/* Reference time, against which delta times on the RTC scale are measured */
|
||||||
static time_t rtc_ref;
|
static time_t rtc_ref;
|
||||||
|
@ -95,7 +95,7 @@ static time_t rtc_ref;
|
||||||
|
|
||||||
/* System clock (gettimeofday) samples associated with the above
|
/* System clock (gettimeofday) samples associated with the above
|
||||||
samples. */
|
samples. */
|
||||||
static struct timeval system_times[MAX_SAMPLES];
|
static struct timeval *system_times = NULL;
|
||||||
|
|
||||||
/* Number of samples currently stored. */
|
/* Number of samples currently stored. */
|
||||||
static int n_samples;
|
static int n_samples;
|
||||||
|
@ -530,6 +530,10 @@ write_coefs_to_file(int valid,time_t ref_time,double offset,double rate)
|
||||||
int
|
int
|
||||||
RTC_Linux_Initialise(void)
|
RTC_Linux_Initialise(void)
|
||||||
{
|
{
|
||||||
|
rtc_sec = MallocArray(time_t, MAX_SAMPLES);
|
||||||
|
rtc_trim = MallocArray(double, MAX_SAMPLES);
|
||||||
|
system_times = MallocArray(struct timeval, MAX_SAMPLES);
|
||||||
|
|
||||||
/* Setup details depending on configuration options */
|
/* Setup details depending on configuration options */
|
||||||
setup_config();
|
setup_config();
|
||||||
|
|
||||||
|
@ -588,6 +592,9 @@ RTC_Linux_Finalise(void)
|
||||||
(void) RTC_Linux_WriteParameters();
|
(void) RTC_Linux_WriteParameters();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Free(rtc_sec);
|
||||||
|
Free(rtc_trim);
|
||||||
|
Free(system_times);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
Loading…
Reference in a new issue