Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
438dd926
Commit
438dd926
authored
Oct 11, 2006
by
Steve French
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CIFS] Fix leaps year calculation for years after 2100
Signed-off-by:
Steve French
<
sfrench@us.ibm.com
>
parent
268f3be1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
fs/cifs/netmisc.c
fs/cifs/netmisc.c
+9
-0
No files found.
fs/cifs/netmisc.c
View file @
438dd926
...
...
@@ -946,6 +946,15 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
year
=
sd
->
Year
;
days
+=
year
*
365
;
days
+=
(
year
/
4
);
/* leap year */
/* generalized leap year calculation is more complex, ie no leap year
for years/100 except for years/400, but since the maximum number for DOS
year is 2**7, the last year is 1980+127, which means we need only
consider 2 special case years, ie the years 2000 and 2100, and only
adjust for the lack of leap year for the year 2100, as 2000 was a
leap year (divisable by 400) */
if
(
year
>=
120
)
/* the year 2100 */
days
=
days
-
1
;
/* do not count leap year for the year 2100 */
/* adjust for leap year where we are still before leap day */
days
-=
((
year
&
0x03
)
==
0
)
&&
(
month
<
2
?
1
:
0
);
sec
+=
24
*
60
*
60
*
days
;
...
...
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