mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Applied Roger Beeman's mktime_from_utc fix published in
<Pine.HPX.4.02.10104181128180.6232-100000@mail1.cisco.com>. Also, minor doc fixes.
This commit is contained in:
parent
d80f6cbe8c
commit
9ae0328c3d
@ -1,3 +1,13 @@
|
||||
2001-04-25 Roger L. Beeman <beeman@cisco.com>
|
||||
|
||||
* http.c (http_atotm): Initialize t.tm_isdst to 0.
|
||||
(mktime_from_utc): Prevent mktime() from having discontinuities at
|
||||
DST transition points.
|
||||
|
||||
2001-04-25 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||
|
||||
* html-url.c (get_urls_html): Fix documentation.
|
||||
|
||||
2001-04-25 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||
|
||||
* url.c (UNSAFE_CHAR): Reimplement using a static table.
|
||||
|
@ -365,7 +365,11 @@ handle_link (struct collect_urls_closure *closure, const char *link_uri,
|
||||
closure->tail = closure->head = newel;
|
||||
}
|
||||
|
||||
/* #### Document what this does.
|
||||
/* Examine name and attributes of TAG and take appropriate action.
|
||||
What will be done depends on TAG's category and attribute values.
|
||||
Tags of TC_LINK category have attributes that contain links to
|
||||
follow; tags of TC_SPEC category need to be handled specially.
|
||||
|
||||
#### It would be nice to split this into several functions. */
|
||||
|
||||
static void
|
||||
@ -523,13 +527,12 @@ collect_tags_mapper (struct taginfo *tag, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan FILE, retrieving links to HTML documents from it. Each link is
|
||||
/* Analyze HTML tags FILE and construct a list of URLs referenced from
|
||||
it. It merges relative links in FILE with THIS_URL. It is aware
|
||||
of <base href=...> and does the right thing.
|
||||
|
||||
Similar to get_urls_file, but for HTML files. FILE is scanned as
|
||||
an HTML document. get_urls_html() constructs the URLs from the
|
||||
relative href-s.
|
||||
|
||||
If SILENT is non-zero, do not barf on baseless relative links. */
|
||||
If dash_p_leaf_HTML is non-zero, only the elements needed to render
|
||||
FILE ("non-external" links) will be returned. */
|
||||
urlpos *
|
||||
get_urls_html (const char *file, const char *this_url, int dash_p_leaf_HTML,
|
||||
int *meta_disallow_follow)
|
||||
|
40
src/http.c
40
src/http.c
@ -1828,17 +1828,37 @@ The sizes do not match (local %ld) -- retrieving.\n"), local_size);
|
||||
than local timezone (mktime assumes the latter).
|
||||
|
||||
Contributed by Roger Beeman <beeman@cisco.com>, with the help of
|
||||
Mark Baushke <mdb@cisco.com> and the rest of the Gurus at CISCO. */
|
||||
Mark Baushke <mdb@cisco.com> and the rest of the Gurus at CISCO.
|
||||
Further improved by Roger with assistance from Edward J. Sabol
|
||||
based on input by Jamie Zawinski. */
|
||||
|
||||
static time_t
|
||||
mktime_from_utc (struct tm *t)
|
||||
{
|
||||
time_t tl, tb;
|
||||
struct tm *tg;
|
||||
|
||||
tl = mktime (t);
|
||||
if (tl == -1)
|
||||
return -1;
|
||||
tb = mktime (gmtime (&tl));
|
||||
return (tl <= tb ? (tl + (tl - tb)) : (tl - (tb - tl)));
|
||||
{
|
||||
t->tm_hour--;
|
||||
tl = mktime (t);
|
||||
if (tl == -1)
|
||||
return -1; /* can't deal with output from strptime */
|
||||
tl += 3600;
|
||||
}
|
||||
tg = gmtime (&tl);
|
||||
tg->tm_isdst = 0;
|
||||
tb = mktime (tg);
|
||||
if (tb == -1)
|
||||
{
|
||||
tg->tm_hour--;
|
||||
tb = mktime (tg);
|
||||
if (tb == -1)
|
||||
return -1; /* can't deal with output from gmtime */
|
||||
tb += 3600;
|
||||
}
|
||||
return (tl - (tb - tl));
|
||||
}
|
||||
|
||||
/* Check whether the result of strptime() indicates success.
|
||||
@ -1888,15 +1908,9 @@ http_atotm (char *time_string)
|
||||
{
|
||||
struct tm t;
|
||||
|
||||
/* Roger Beeman says: "This function dynamically allocates struct tm
|
||||
t, but does no initialization. The only field that actually
|
||||
needs initialization is tm_isdst, since the others will be set by
|
||||
strptime. Since strptime does not set tm_isdst, it will return
|
||||
the data structure with whatever data was in tm_isdst to begin
|
||||
with. For those of us in timezones where DST can occur, there
|
||||
can be a one hour shift depending on the previous contents of the
|
||||
data area where the data structure is allocated." */
|
||||
t.tm_isdst = -1;
|
||||
/* According to Roger Beeman, we need to initialize tm_isdst, since
|
||||
strptime won't do it. */
|
||||
t.tm_isdst = 0;
|
||||
|
||||
/* Note that under foreign locales Solaris strptime() fails to
|
||||
recognize English dates, which renders this function useless. I
|
||||
|
Loading…
Reference in New Issue
Block a user