Local time?

Russ Allbery rra at stanford.edu
Sun Jan 2 22:37:27 UTC 2000


Paul Tomblin <ptomblin at xcski.com> writes:

> I recently upgraded from inn 1.4 to inn 2.2.2 (and from Sun OS 4.x to
> Solaris 7).  My users are complaining that the dates on the articles
> they post are stored in GMT, instead of in local time.  I try and tell
> them that this is a news reader issue, that the news reader should do
> the conversion from GMT to local time when it displays the articles, but
> most of them are stuck using a really awful news reader and there isn't
> much hope of getting it fixed.

> Is there a way I can make inews put a Date header in local time?  Is
> that the correct place to "fix" this problem?

It's not inews; inews inserts Date headers in local time.  It's in
nnrpd/post.c and was an intentional design decision:

    /* Set Date. */
    if (GetTimeInfo(&Now) < 0) {
        (void)sprintf(Error, "Can't get the time, %s", strerror(errno));
        return Error;
    }

    if ((gmt = gmtime(&Now.time)) == NULL)
            return "Can't get the time";
    (void)sprintf(datebuff, "%d %3.3s %d %02d:%02d:%02d GMT",
            gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year,
            gmt->tm_hour, gmt->tm_min, gmt->tm_sec);

You can switch from gmtime to localtime; just make sure to then add the
zone information to the Date header.  Take a look at the code in
frontends/inews.c to see how (look around line 634).

-- 
Russ Allbery (rra at stanford.edu)         <URL:http://www.eyrie.org/~eagle/>



More information about the inn-workers mailing list