[prev in list] [next in list] [prev in thread] [next in thread] 

List:       proftpd-committers
Subject:    [ProFTPD-committers] [Bug 2691] ProFTPD terminating (signal 11) when call is made to localtime in mo
From:       bugzilla-daemon () horde ! net
Date:       2005-09-21 18:09:31
Message-ID: 20050921180931.CCD134049 () boost ! horde ! net
[Download RAW message or body]

http://bugs.proftpd.org/show_bug.cgi?id=2691





------- Additional Comments From bennie.95@alum.mines.edu  2005-09-21 14:09 Eastern -------
The man pages had the following to say about the TZ environment variable:

man -s 5 environ

     TZ    Timezone information. The contents of this environment
           variable   are   used   by  the  functions  ctime(3C),
           localtime(3C), strftime(3C), and mktime(3C)  to  over-
           ride the default timezone. If TZ is not in the follow-
           ing form, it designates a path to a  timezone database
           file  relative  to  /usr/share/lib/zoneinfo/, ignoring
           the first character if it is a colon  (:);  otherwise,
           TZ has the form:


                stdoffset[dst[offset],[start[/time],end[/time]]]

As a side note, I wrote a simple C application that calls the same function that
is failing in proftpd and it did not fail:

#include <time.h>

static struct tm *_get_gmtoff(int *tz);

int main()
{
  int value = 0;

  struct tm *temp = _get_gmtoff( &value );

  printf( "value = %d\n", value );

}

static struct tm *_get_gmtoff(int *tz)
{
  time_t tt = time( NULL );
  struct tm gmt;
  struct tm *t = NULL;
  int days,hours,minutes;


  gmt = *gmtime(&tt);
  t = localtime(&tt);

  days = t->tm_yday - gmt.tm_yday;
  hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24)
          + t->tm_hour - gmt.tm_hour);
  minutes = hours * 60 + t->tm_min - gmt.tm_min;
  *tz = minutes;
  return t;
}

With the following results:
 ./localtime_test 
value = -300


-- 
Configure bugmail: http://bugs.proftpd.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
ProFTPD Committers Mailing List
proftpd-committers@proftpd.org
https://lists.sourceforge.net/lists/listinfo/proftp-committers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic