This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gettimeofday and POSIX


Jeff Johnston wrote:
Pedro Alves wrote:
Hi Jeff,

Jeff Johnston wrote:

How about the attached patch instead? It goes through and cleans up all the implementations as well so there is no need for the flag check.



--- libgloss/crx/time.c 5 Oct 2004 20:00:53 -0000 1.1
+++ libgloss/crx/time.c 5 Jul 2007 17:48:54 -0000
@@ -43,8 +43,9 @@ clock_t times (struct tms *buf)
}
/* _gettimeofday -- implement in terms of time. */
-int gettimeofday (struct timeval *tv, struct timezone *tz)
+int gettimeofday (struct timeval *tv, void *tzvp)
{
+ struct time *tz = (struct timezone *)tzvp;

struct timezone *tz = (struct timezone *)tzvp; ??




This version of gettimeofday actually expects tz to point to a struct timezone and accesses the tz structure fields (i.e. tz->xxxxx). It now passes in a void pointer so I named the input parameter tzvp (vp for void pointer) and then just set the local pointer tz; this avoided having to change the rest of the code.


I get that, but there is a typo there: struct time * != struct timezone *

:)

Cheers,
Pedro Alves


And why the casts? Too much c++ recently? :)


Just tired I'm afraid :)


-- Jeff J.





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]