Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
17acdb5a
Commit
17acdb5a
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
slightly better but still lacks
parent
f6433211
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/parsedate.c
+14
-37
14 additions, 37 deletions
lib/parsedate.c
with
14 additions
and
37 deletions
lib/parsedate.c
+
14
−
37
View file @
17acdb5a
...
...
@@ -62,10 +62,10 @@
static
const
char
*
wkday
[]
=
{
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
,
"Sun"
};
static
const
char
*
weekday
[]
=
{
"Monday"
,
"Tuesday"
,
"Wednesday"
,
"Thursday"
,
"Friday"
,
"Saturday"
,
"Sunday"
};
static
const
char
*
month
[]
=
{
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
};
const
char
*
Curl_
month
[]
=
{
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
};
static
const
char
*
tz
[]
=
{
"GMT"
,
"UTC"
};
static
const
char
*
tz
[]
=
{
"GMT"
,
"UTC"
,
"MET"
};
/* returns:
-1 no day
...
...
@@ -97,7 +97,7 @@ static int checkmonth(char *check)
const
char
**
what
;
bool
found
=
FALSE
;
what
=
&
month
[
0
];
what
=
&
Curl_
month
[
0
];
for
(
i
=
0
;
i
<
12
;
i
++
)
{
if
(
curl_strequal
(
check
,
what
[
0
]))
{
found
=
TRUE
;
...
...
@@ -256,6 +256,15 @@ time_t Curl_parsedate(const char *date)
part
++
;
}
if
(
-
1
==
secnum
)
secnum
=
minnum
=
hournum
=
0
;
/* no time, make it zero */
if
((
-
1
==
mdaynum
)
||
(
-
1
==
monnum
)
||
(
-
1
==
yearnum
))
/* lacks vital info, fail */
return
-
1
;
tm
.
tm_sec
=
secnum
;
tm
.
tm_min
=
minnum
;
tm
.
tm_hour
=
hournum
;
...
...
@@ -268,8 +277,7 @@ time_t Curl_parsedate(const char *date)
t
=
mktime
(
&
tm
);
/* We have the time-stamp now, but in our local time zone, we must now
adjust it to GMT. */
/* time zone adjust */
{
struct
tm
*
gmt
;
long
delta
;
...
...
@@ -296,34 +304,3 @@ time_t curl_getdate(const char *p, const time_t *now)
(
void
)
now
;
return
Curl_parsedate
(
p
);
}
#ifdef TESTIT
int
main
(
void
)
{
char
buffer
[
1024
];
char
cmd
[
1024
];
time_t
t
;
while
(
fgets
(
buffer
,
sizeof
(
buffer
),
stdin
))
{
size_t
len
=
strlen
(
buffer
);
buffer
[
len
-
1
]
=
0
;
/* cut off newline */
t
=
curl_getdate
(
buffer
,
NULL
);
printf
(
"curl_getdate(): %d
\n
"
,
t
);
sprintf
(
cmd
,
"date -d
\"
%s
\"
+%%s"
,
buffer
);
printf
(
"GNU date:
\n
"
);
system
(
cmd
);
t
=
parse_a_date
(
buffer
);
printf
(
"parse_a_date: %d
\n
===================
\n\n
"
,
t
);
}
return
0
;
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment