Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
29644144
Commit
29644144
authored
Jul 04, 2018
by
antirez
Browse files
Localtime: fix comment about leap year.
parent
0ea39aa4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/localtime.c
View file @
29644144
...
@@ -79,7 +79,7 @@ void nolocks_localtime(struct tm *tmp, time_t t, time_t tz, int dst) {
...
@@ -79,7 +79,7 @@ void nolocks_localtime(struct tm *tmp, time_t t, time_t tz, int dst) {
/* Calculate the current year. */
/* Calculate the current year. */
tmp
->
tm_year
=
1970
;
tmp
->
tm_year
=
1970
;
while
(
1
)
{
while
(
1
)
{
/* Leap years have one
year
more. */
/* Leap years have one
day
more. */
time_t
days_this_year
=
365
+
is_leap_year
(
tmp
->
tm_year
);
time_t
days_this_year
=
365
+
is_leap_year
(
tmp
->
tm_year
);
if
(
days_this_year
>
days
)
break
;
if
(
days_this_year
>
days
)
break
;
days
-=
days_this_year
;
days
-=
days_this_year
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment