Tcl Source Code

View Ticket
Login
Ticket UUID: 1942197
Title: incorrect use of gettimeofday() in unix/tclUnixTime.c
Type: Bug Version: obsolete: 8.5.2
Submitter: karllim Created on: 2008-04-14 15:38:02
Subsystem: 69. Other Assigned To: kennykb
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2012-06-01 23:02:47
Resolution: Fixed Closed By: kennykb
    Closed on: 2008-04-14 17:54:27
Description:
The Open Group defines gettimeofday() with the following prototype :
 int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

However, TCL uses a struct timezone as the second argument, where it is described that anything else than a NULL tzp argument is undefined.

Solution : pass NULL.
User Comments: dgp added on 2012-06-01 23:02:47:
See Bug 3530533 for problems this change
causes on an IRIX64 6.5 system.

kennykb added on 2008-04-15 00:26:57:
Logged In: YES 
user_id=99768
Originator: NO

Passing a NULL 'tzp' argument to gettimeofday is verified as harmless (indeed, preferred) on Solaris, HP-UX, glibc, the various BSD's (and hence MacOSX), and AIX.  Doesn't seem to be any reason not to commit.

kennykb added on 2008-04-15 00:17:29:
Logged In: YES 
user_id=99768
Originator: NO

Agreed that second arg to gettimeofday should be NULL on modern Unixes.  There's an open question regarding whether we support any environments where a non-NULL second arg is still required.  (It seems unlikely, since Posix says that the second arg SHOULD be NULL.)

Change is trivial, and I'll make it when I've done a bit more research.

karllim added on 2008-04-14 22:38:03:

File Added - 274484: tcl_timezone_20080414.diff

Attachments: