Package: manpages-dev
Version: 2.67-1
Severity: minor
File: /usr/share/man/man2/settimeofday.2.gz



-- System Information:
Debian Release: lenny/sid
  APT prefers oldstable
  APT policy: (500, 'oldstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-4-486
Locale: LANG=ja_JP.EUC-JP, LC_CTYPE=ja_JP.EUC-JP (charmap=EUC-JP)
Shell: /bin/sh linked to /bin/bash

Versions of packages manpages-dev depends on:
ii  manpages                      2.67-1     Manual pages about using a
GNU/Lin

manpages-dev recommends no packages.

-- no debconf information



`man settimeofday' says:

        The use of the timezone structure is obsolete; the tz  argument
        should normally  be  specified  as  NULL.

But, on linux kernel, the FAT filesystem driver uses tz->tz_minuteswest
parameter for timestamp conversion.  `tz' argument is still alive, not
retired.



Here is the detail in kernel:
linux-2.6.17.1/kernel/time.c handles settimeofday(2) syscall and stores
tz parameter into sys_tz global variable.
//////////
struct timezone sys_tz;

EXPORT_SYMBOL(sys_tz);

...(snip)...

int do_sys_settimeofday(struct timespec *tv, struct timezone *tz)
{
        static int firsttime = 1;
        int error = 0;

        if (tv && !timespec_valid(tv))
                return -EINVAL;

        error = security_settime(tv, tz);
        if (error)
                return error;

        if (tz) {
                /* SMP safe, global irq locking makes it work. */
                sys_tz = *tz;
                if (firsttime) {
                        firsttime = 0;
                        if (!tv)
                                warp_clock();
                }
        }
        if (tv)
        {
                /* SMP safe, again the code in arch/foo/time.c should
                 * globally block out interrupts when it runs.
                 */
                return do_settimeofday(tv);
        }
        return 0;
}
//////////



linux-2.6.17.1/fs/fat/misc.c uses the `sys_tz' variable for timestamp
conversion.   FAT filesystem has only yy-mm-dd-hh-mm-ss format
timestamp, no timezone infomation.  So linux kernel handles the
timestamp as localtime with using tz->tz_minuteswest parameter.
//////////
extern struct timezone sys_tz;

...(snip)...

/* Convert a MS-DOS time/date pair to a UNIX date (seconds since 1 1 70). */
int date_dos2unix(unsigned short time, unsigned short date)
{
        int month, year, secs;

        /*
         * first subtract and mask after that... Otherwise, if
         * date == 0, bad things happen
         */
        month = ((date >> 5) - 1) & 15;
        year = date >> 9;
        secs = (time & 31)*2+60*((time >> 5) & 63)+(time >> 11)*3600+86400*
            ((date & 31)-1+day_n[month]+(year/4)+year*365-((year & 3) ==
0 &&
            month < 2 ? 1 : 0)+3653);
                        /* days since 1.1.70 plus 80's leap day */
        secs += sys_tz.tz_minuteswest*60;
        return secs;
}
//////////


Thanks.
----
Kunihiko IMAI



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to