int archdep_init(int *argc, char **argv) { if (*argc == 0) { /* run from WB */ run_from_wb = 1; } else { /* run from CLI */ run_from_wb = 0; } #if defined(AMIGA_M68K) && !defined(HAVE_GETTIMEOFDAY) gettimeofday_init(); #endif return 0; }
/** * Return the current time broken into a timeval structure. * * @param tv A pointer to a timeval structure. * @param tz Added for compatability - not used. * @return 0 for success (this function cannot return non-zero currently). */ int gettimeofday(struct timeval *tv, void *tz) { /* * Call the gtod init when we need it - this keeps the code from * being included in the binary if we don't need it. */ if (!clock.ticks) gettimeofday_init(); update_clock(); tv->tv_sec = clock.secs; tv->tv_usec = clock.usecs; return 0; }
/** * Return the current time broken into a timeval structure. * * @param tv A pointer to a timeval structure. * @param tz Added for compatability - not used. * @return 0 for success (this function cannot return non-zero currently). * * WARNING : In this implementation gettimeofday() will not work until the cpu is not initialized. */ int gettimeofday(struct timeval *tv, void *tz) { cpu_khz = (uint32_t)(get_env(envCPUFreq) / 1000); if (!(cpu_khz>0)) { return -1; } /* * Call the gtod init when we need it - this keeps the code from * being included in the binary if we don't need it. */ if (!private_clock.ticks) gettimeofday_init(); update_clock(); tv->tv_sec = private_clock.secs; tv->tv_usec = private_clock.usecs; return 0; }