On 2012-02-24, Peter Bigot <big...@acm.org> wrote: > On Fri, Feb 24, 2012 at 12:30 PM, Grant Edwards ><grant.b.edwa...@gmail.com>wrote: > >> On 2012-02-24, Peter Bigot <big...@acm.org> wrote: >> > On Fri, Feb 24, 2012 at 10:09 AM, N. Coesel <n...@nctdev.nl> wrote: >> >>> A lot of devices do need to keep track of date & time. Instead of >> >> re-inventing the wheel its better to use a different (small) C >> >> library which has these functions and stay Posix compliant. >> > >> > Agreed; the underlying function might have to be user-provided just >> > as putchar is for msp430-libc, but the API should be standard. >> >> I'm not sure I see the point of the extra layer. Are there other >> library functions besides gettimeofday() that would call the >> underlying, user-provided function-that-isnt-gettimeofday? >> > > My point is that there is value in re-using the POSIX API including struct > timeval and gettimeofday/settimeofday, which have commonly understood and > documented semantics, rather than inventing a new time representation and > way to manipulate it.
Agreed. > It may be that gettimeofday is the fundamental function that must be > user-provided. That was my question. > (Although clock_gettime() might be an alternative to consider, > especially since it's paired with clock_getres(), which could be > useful.) Yes, it looks like those might be a better "base". AFAICT, you can implement gettimeofday() on top of clock_gettime(), but not the other way around. > Once you have gettimeofday with struct timeval, you can add > localtime/gmtime and struct tm, and then strftime, and you can > interact with your RTC with a well-known API. -- Grant Edwards grant.b.edwards Yow! Well, O.K. at I'll compromise with my gmail.com principles because of EXISTENTIAL DESPAIR! ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users