insane-adding-machines / frosted

Frosted: Free POSIX OS for tiny embedded devices
GNU General Public License v2.0
213 stars 39 forks source link

[LibC] Implement 'clock_gettime', 'clock_settime', 'clock_getres' #116

Closed nathanLoretan closed 7 years ago

nathanLoretan commented 7 years ago

Hello, I try to use the function clock_gettime(). I define _POSIX_TIMERS and I include but I always have the error: undefined reference to 'clock_gettime'.

danielinux commented 7 years ago

Hi! In fact clock_gettime/clock_settime/clock_getres are not yet implemented in libC.

I will turn this issue in a feature request and take care of it ASAP. Meanwhile, any chance you can use gettimeofday() ?

Thanks

d

danielinux commented 7 years ago

Not fixed yet for us, so better not close it @nathanLoretan

brabo commented 7 years ago

ok, this is next up on my frosted-calendar!

brabo commented 7 years ago

@nathanLoretan what resolution are you guys expecting clock_gettime() to have? assuming XSI-conformance or?

nathanLoretan commented 7 years ago

CLOCK_REALTIME

On Mar 7, 2017 2:22 AM, "brabo" notifications@github.com wrote:

@nathanLoretan https://github.com/nathanLoretan what resolution are you guys expecting clock_gettime() to have? assuming XSI-conformance or?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/insane-adding-machines/frosted/issues/116#issuecomment-284590402, or mute the thread https://github.com/notifications/unsubscribe-auth/AVzCXqzY2l0ufmU-3Uj1KQyQxnW-Apglks5rjLE6gaJpZM4Lu44f .

brabo commented 7 years ago

@nathanLoretan that is a clock, not the resolution. i ask because of: "Although the value of CLOCKS_PER_SEC is required to be 1 million on all XSI-conformant systems, it may be variable on other systems, and it should not be assumed that CLOCKS_PER_SEC is a compile-time constant" if you assume 1 million per second, it may cause issues as our system clock resolution is only 1000/sec, i.e. millisecond resolution, and i noticed there is no clock_getres() call in uGFX to determine what resolution the system has.

danielinux commented 7 years ago

@brabo we should stick with 1ms resolution for these calls anyhow

brabo commented 7 years ago

@nathanLoretan done, closing this issue ;)

brabo commented 7 years ago

@nathanLoretan note, just include sys/time.h for now, not time.h as posix specifies.

danielinux commented 7 years ago

Related to #120

brabo commented 7 years ago

time.h is there now.