Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
236ebf35
Commit
236ebf35
authored
Jul 23, 1996
by
Richard M. Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Fdecode_time, difftm): Work even if tm_year represents
negative years; this is possible with 64-bit time_t values.
parent
0f93e41f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
src/editfns.c
src/editfns.c
+6
-3
No files found.
src/editfns.c
View file @
236ebf35
...
...
@@ -693,7 +693,7 @@ ZONE is an integer indicating the number of seconds east of Greenwich.\n\
XSETFASTINT
(
list_args
[
2
],
decoded_time
->
tm_hour
);
XSETFASTINT
(
list_args
[
3
],
decoded_time
->
tm_mday
);
XSETFASTINT
(
list_args
[
4
],
decoded_time
->
tm_mon
+
1
);
XSET
FAST
INT
(
list_args
[
5
],
decoded_time
->
tm_year
+
1900
);
XSETINT
(
list_args
[
5
],
decoded_time
->
tm_year
+
1900
);
XSETFASTINT
(
list_args
[
6
],
decoded_time
->
tm_wday
);
list_args
[
7
]
=
(
decoded_time
->
tm_isdst
)
?
Qt
:
Qnil
;
...
...
@@ -828,14 +828,17 @@ difftm (a, b)
{
int
ay
=
a
->
tm_year
+
(
TM_YEAR_ORIGIN
-
1
);
int
by
=
b
->
tm_year
+
(
TM_YEAR_ORIGIN
-
1
);
/* Divide years by 100, rounding towards minus infinity. */
int
ac
=
ay
/
100
-
(
ay
%
100
<
0
);
int
bc
=
by
/
100
-
(
by
%
100
<
0
);
/* Some compilers can't handle this as a single return statement. */
long
days
=
(
/* difference in day of year */
a
->
tm_yday
-
b
->
tm_yday
/* + intervening leap days */
+
((
ay
>>
2
)
-
(
by
>>
2
))
-
(
a
y
/
100
-
by
/
100
)
+
((
a
y
/
100
>>
2
)
-
(
b
y
/
100
>>
2
))
-
(
a
c
-
bc
)
+
((
a
c
>>
2
)
-
(
b
c
>>
2
))
/* + difference in years * 365 */
+
(
long
)(
ay
-
by
)
*
365
);
...
...
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