Re: wrong timestamps

2005-07-20 Thread Alain Guibert
 On Tuesday, July 5, 2005 at 6:59:04 PM +0200, Hrvoje Niksic wrote:

 Am I completely off the mark, or can mktime_from_utc (or in fact
 timegm) be replaced by something as simple as the following? Or is it
 too good to be true?

It returns a number of seconds since epoch neglecting leap seconds. This
number is later given to the system for file timestamps, display, and
such. I believe this can unfortunately be wrong by about 22s on
platforms without timegm() but counting leap seconds. Untested though.

It seems many platforms directly or optionally account for leap seconds.
Example Linux Woody by default neglects but optionally accounts leap
seconds when timezone info comes from the right directory.

| $ TZ=UTC   date --date 9 Sep 2001 1:46:40 UTC +%s
| 10
| $ TZ=right/UTC date --date 9 Sep 2001 1:46:40 UTC +%s
| 100022

The first is the common Posix simplification, the later is The Truth.


By the way: After 7 years of stability, the IERS announced officialy
that the next added leap second will be December 31 2005 23:59:60 UTC.


Alain.


[Fwd: Bug#319088: wget: don't rely on exactly one blank char between size and month]

2005-07-20 Thread Noèl Köthe
Hello,

giuseppe wrote a patch for 1.10.1.beta1. Full report can be viewed here:
http://bugs.debian.org/319088

 Weitergeleitete Nachricht 
 Von: giuseppe bonacci [EMAIL PROTECTED]
 Antwort an: giuseppe bonacci [EMAIL PROTECTED],
 [EMAIL PROTECTED]
 An: Debian Bug Tracking System [EMAIL PROTECTED]
 Betreff: Bug#319088: wget: don't rely on exactly one blank char
 between size and month
 Datum: Wed, 20 Jul 2005 10:26:20 +0200
 
 Package: wget
 Version: 1.10-3+1.10.1beta1
 Followup-For: Bug #319088
 
 
 A better patch is the following, that drops the assumption that there
 is exactly one blank char between size and month (implicit in the
 statement char *t = tok - 2;).
 
 As far as I know, strtok() modifies the string
 1234  aaa  bbb@ (where @ stands for \0, for clarity)
 so that when tok points to aaa the string looks like
 1234@ aaa@ bbb@, 
 and (tok - 2) points to , which is not useful for backtracking.
 I think the best way to access the previous token is ... keeping a pointer
 to it.
 g.b.
 
 
 --- wget-1.10/src/ftp-ls.c.orig   2005-05-12 18:24:33.0 +0200
 +++ wget-1.10/src/ftp-ls.c2005-07-20 09:53:30.206791032 +0200
 @@ -110,7 +110,7 @@
struct tm timestruct, *tnow;
time_t timenow;
  
 -  char *line, *tok;  /* tokenizer */
 +  char *line, *tok, *ptok;   /* tokenizer */
struct fileinfo *dir, *l, cur; /* list creation */
  
fp = fopen (file, rb);
 @@ -201,7 +201,9 @@
This tactic is quite dubious when it comes to
internationalization issues (non-English month names), but it
works for now.  */
 -  while ((tok = strtok (NULL,  )) != NULL)
 +  ptok = line;
 +  while (ptok = tok,
 +   (tok = strtok(NULL,  )) != NULL)
   {
 --next;
 if (next  0) /* a month name was not encountered */
 @@ -217,9 +219,7 @@
  
 /* Back up to the beginning of the previous token
and parse it with str_to_wgint.  */
 -   char *t = tok - 2;
 -   while (t  line  ISDIGIT (*t))
 - --t;
 +   char *t = ptok;
 if (t == line)
   {
 /* Something has gone wrong during parsing. */
 
 -- System Information:
 Debian Release: testing/unstable
   APT prefers testing
   APT policy: (500, 'testing')
 Architecture: i386 (i686)
 Shell:  /bin/sh linked to /bin/bash
 Kernel: Linux 2.6.8-2-686-smp
 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
 
 Versions of packages wget depends on:
 ii  libc6   2.3.2.ds1-22 GNU C Library: Shared libraries 
 an
 ii  libssl0.9.7 0.9.7e-3 SSL shared libraries
 
 wget recommends no packages.
 
 -- no debconf information
 

-- 
Noèl Köthe noel debian.org
Debian GNU/Linux, www.debian.org


signature.asc
Description: This is a digitally signed message part