Skip to content

Adding an argument to gettz() #6

@Rhialto

Description

@Rhialto

Hi! I was going through some patches for zoo that are present in pkgsrc, to see if they are still needed or not. Many changes relate to removing duplicate declarations of standard functions, and including the appropriate standard header instead. Many of those seem to be left. But of course I got stuck in the third file or so that I looked at with a less trivial change.

There was a patch that changes the body of tzadj() to

void tzadj(direntry)
struct direntry *direntry;
{
	long diff_tz;
	long longtime;
	long t;

	if (direntry->tz == NO_TZ)	 /* none stored */
		return;

	t = mstonix (direntry->date, direntry->time);
	diff_tz = (long) direntry->tz * (3600/4) - gettz(t); /* diff. in seconds */
	longtime = t + diff_tz; /* adj tz */
	mstime(longtime, &direntry->date, &direntry->time);
}

The main difference is that gettz() gets an argument. Presumably so that it can calculate the time zone offset related to that particular time, and not that of the current time. That sounds sensible to me.

However in the same patch set I didn't find anything to add this argument to the existing gettz() functions... which is a bit weird.

Since I didn't want to invent new things with this effort, but just contribute still sensible existing patches, I'm bouncing this one to you. It probably makes sense to incorporate this change and create the properly changed gettz() too. And it also likely makes sense to remove the duplicate versions of that function and just settle on one version that simply works for all variants...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions