Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite9a028f

Browse files
committed
Convert DOS newlines to Unix newlines.
1 parent7146eb0 commite9a028f

File tree

9 files changed

+4751
-4753
lines changed

9 files changed

+4751
-4753
lines changed

‎src/timezone/asctime.c

Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,75 @@
1-
#include"pgtz.h"
2-
/*
3-
** This file is in the public domain, so clarified as of
4-
** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
5-
*/
6-
7-
#ifndeflint
8-
#ifndefNOID
9-
staticcharelsieid[]="@(#)asctime.c7.9";
10-
#endif/* !defined NOID */
11-
#endif/* !defined lint */
12-
13-
/*LINTLIBRARY*/
14-
15-
#include"private.h"
16-
#include"tzfile.h"
17-
18-
/*
19-
** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, Second Edition, 1996-07-12.
20-
*/
21-
22-
char*
23-
asctime_r(timeptr,buf)
24-
registerconststructtm*timeptr;
25-
char*buf;
26-
{
27-
staticconstcharwday_name[][3]= {
28-
"Sun","Mon","Tue","Wed","Thu","Fri","Sat"
29-
};
30-
staticconstcharmon_name[][3]= {
31-
"Jan","Feb","Mar","Apr","May","Jun",
32-
"Jul","Aug","Sep","Oct","Nov","Dec"
33-
};
34-
registerconstchar*wn;
35-
registerconstchar*mn;
36-
37-
if (timeptr->tm_wday<0||timeptr->tm_wday >=DAYSPERWEEK)
38-
wn="???";
39-
elsewn=wday_name[timeptr->tm_wday];
40-
if (timeptr->tm_mon<0||timeptr->tm_mon >=MONSPERYEAR)
41-
mn="???";
42-
elsemn=mon_name[timeptr->tm_mon];
43-
/*
44-
** The X3J11-suggested format is
45-
**"%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n"
46-
** Since the .2 in 02.2d is ignored, we drop it.
47-
*/
48-
(void)sprintf(buf,"%.3s %.3s%3d %02d:%02d:%02d %d\n",
49-
wn,mn,
50-
timeptr->tm_mday,timeptr->tm_hour,
51-
timeptr->tm_min,timeptr->tm_sec,
52-
TM_YEAR_BASE+timeptr->tm_year);
53-
returnbuf;
54-
}
55-
56-
/*
57-
** A la X3J11, with core dump avoidance.
58-
*/
59-
60-
char*
61-
asctime(timeptr)
62-
registerconststructtm*timeptr;
63-
{
64-
/*
65-
** Big enough for something such as
66-
** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
67-
** (two three-character abbreviations, five strings denoting integers,
68-
** three explicit spaces, two explicit colons, a newline,
69-
** and a trailing ASCII nul).
70-
*/
71-
staticcharresult[3*2+5*INT_STRLEN_MAXIMUM(int)+
72-
3+2+1+1];
73-
74-
returnasctime_r(timeptr,result);
75-
}
1+
#include"pgtz.h"
2+
/*
3+
** This file is in the public domain, so clarified as of
4+
** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
5+
*/
6+
7+
#ifndeflint
8+
#ifndefNOID
9+
staticcharelsieid[]="@(#)asctime.c7.9";
10+
#endif/* !defined NOID */
11+
#endif/* !defined lint */
12+
13+
/*LINTLIBRARY*/
14+
15+
#include"private.h"
16+
#include"tzfile.h"
17+
18+
/*
19+
** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, Second Edition, 1996-07-12.
20+
*/
21+
22+
char*
23+
asctime_r(timeptr,buf)
24+
registerconststructtm*timeptr;
25+
char*buf;
26+
{
27+
staticconstcharwday_name[][3]= {
28+
"Sun","Mon","Tue","Wed","Thu","Fri","Sat"
29+
};
30+
staticconstcharmon_name[][3]= {
31+
"Jan","Feb","Mar","Apr","May","Jun",
32+
"Jul","Aug","Sep","Oct","Nov","Dec"
33+
};
34+
registerconstchar*wn;
35+
registerconstchar*mn;
36+
37+
if (timeptr->tm_wday<0||timeptr->tm_wday >=DAYSPERWEEK)
38+
wn="???";
39+
elsewn=wday_name[timeptr->tm_wday];
40+
if (timeptr->tm_mon<0||timeptr->tm_mon >=MONSPERYEAR)
41+
mn="???";
42+
elsemn=mon_name[timeptr->tm_mon];
43+
/*
44+
** The X3J11-suggested format is
45+
**"%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n"
46+
** Since the .2 in 02.2d is ignored, we drop it.
47+
*/
48+
(void)sprintf(buf,"%.3s %.3s%3d %02d:%02d:%02d %d\n",
49+
wn,mn,
50+
timeptr->tm_mday,timeptr->tm_hour,
51+
timeptr->tm_min,timeptr->tm_sec,
52+
TM_YEAR_BASE+timeptr->tm_year);
53+
returnbuf;
54+
}
55+
56+
/*
57+
** A la X3J11, with core dump avoidance.
58+
*/
59+
60+
char*
61+
asctime(timeptr)
62+
registerconststructtm*timeptr;
63+
{
64+
/*
65+
** Big enough for something such as
66+
** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
67+
** (two three-character abbreviations, five strings denoting integers,
68+
** three explicit spaces, two explicit colons, a newline,
69+
** and a trailing ASCII nul).
70+
*/
71+
staticcharresult[3*2+5*INT_STRLEN_MAXIMUM(int)+
72+
3+2+1+1];
73+
74+
returnasctime_r(timeptr,result);
75+
}

‎src/timezone/difftime.c

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
1-
#include"pgtz.h"
2-
/*
3-
** This file is in the public domain, so clarified as of
4-
** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
5-
*/
6-
7-
#ifndeflint
8-
#ifndefNOID
9-
staticcharelsieid[]="@(#)difftime.c7.9";
10-
#endif/* !defined NOID */
11-
#endif/* !defined lint */
12-
13-
/*LINTLIBRARY*/
14-
15-
#include"private.h"
16-
17-
/*
18-
** Algorithm courtesy Paul Eggert (eggert@twinsun.com).
19-
*/
20-
21-
#ifdefHAVE_LONG_DOUBLE
22-
#definelong_doublelong double
23-
#endif/* defined HAVE_LONG_DOUBLE */
24-
#ifndefHAVE_LONG_DOUBLE
25-
#definelong_doubledouble
26-
#endif/* !defined HAVE_LONG_DOUBLE */
27-
28-
double
29-
difftime(time1,time0)
30-
consttime_ttime1;
31-
consttime_ttime0;
32-
{
33-
time_tdelta;
34-
time_thibit;
35-
36-
{
37-
time_ttt;
38-
doubled;
39-
long_doubleld;
40-
41-
if (sizeoftt<sizeofd)
42-
return (double)time1- (double)time0;
43-
if (sizeoftt<sizeofld)
44-
return (long_double)time1- (long_double)time0;
45-
}
46-
if (time1<time0)
47-
return-difftime(time0,time1);
48-
/*
49-
** As much as possible, avoid loss of precision
50-
** by computing the difference before converting to double.
51-
*/
52-
delta=time1-time0;
53-
if (delta >=0)
54-
returndelta;
55-
/*
56-
** Repair delta overflow.
57-
*/
58-
hibit= (~ (time_t)0) << (TYPE_BIT(time_t)-1);
59-
/*
60-
** The following expression rounds twice, which means
61-
** the result may not be the closest to the true answer.
62-
** For example, suppose time_t is 64-bit signed int,
63-
** long_double is IEEE 754 double with default rounding,
64-
** time1 = 9223372036854775807 and time0 = -1536.
65-
** Then the true difference is 9223372036854777343,
66-
** which rounds to 9223372036854777856
67-
** with a total error of 513.
68-
** But delta overflows to -9223372036854774273,
69-
** which rounds to -9223372036854774784, and correcting
70-
** this by subtracting 2 * (long_double) hibit
71-
** (i.e. by adding 2**64 = 18446744073709551616)
72-
** yields 9223372036854776832, which
73-
** rounds to 9223372036854775808
74-
** with a total error of 1535 instead.
75-
** This problem occurs only with very large differences.
76-
** It's too painful to fix this portably.
77-
** We are not alone in this problem;
78-
** some C compilers round twice when converting
79-
** large unsigned types to small floating types,
80-
** so if time_t is unsigned the "return delta" above
81-
** has the same double-rounding problem with those compilers.
82-
*/
83-
returndelta-2* (long_double)hibit;
84-
}
1+
#include"pgtz.h"
2+
/*
3+
** This file is in the public domain, so clarified as of
4+
** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
5+
*/
6+
7+
#ifndeflint
8+
#ifndefNOID
9+
staticcharelsieid[]="@(#)difftime.c7.9";
10+
#endif/* !defined NOID */
11+
#endif/* !defined lint */
12+
13+
/*LINTLIBRARY*/
14+
15+
#include"private.h"
16+
17+
/*
18+
** Algorithm courtesy Paul Eggert (eggert@twinsun.com).
19+
*/
20+
21+
#ifdefHAVE_LONG_DOUBLE
22+
#definelong_doublelong double
23+
#endif/* defined HAVE_LONG_DOUBLE */
24+
#ifndefHAVE_LONG_DOUBLE
25+
#definelong_doubledouble
26+
#endif/* !defined HAVE_LONG_DOUBLE */
27+
28+
double
29+
difftime(time1,time0)
30+
consttime_ttime1;
31+
consttime_ttime0;
32+
{
33+
time_tdelta;
34+
time_thibit;
35+
36+
{
37+
time_ttt;
38+
doubled;
39+
long_doubleld;
40+
41+
if (sizeoftt<sizeofd)
42+
return (double)time1- (double)time0;
43+
if (sizeoftt<sizeofld)
44+
return (long_double)time1- (long_double)time0;
45+
}
46+
if (time1<time0)
47+
return-difftime(time0,time1);
48+
/*
49+
** As much as possible, avoid loss of precision
50+
** by computing the difference before converting to double.
51+
*/
52+
delta=time1-time0;
53+
if (delta >=0)
54+
returndelta;
55+
/*
56+
** Repair delta overflow.
57+
*/
58+
hibit= (~ (time_t)0) << (TYPE_BIT(time_t)-1);
59+
/*
60+
** The following expression rounds twice, which means
61+
** the result may not be the closest to the true answer.
62+
** For example, suppose time_t is 64-bit signed int,
63+
** long_double is IEEE 754 double with default rounding,
64+
** time1 = 9223372036854775807 and time0 = -1536.
65+
** Then the true difference is 9223372036854777343,
66+
** which rounds to 9223372036854777856
67+
** with a total error of 513.
68+
** But delta overflows to -9223372036854774273,
69+
** which rounds to -9223372036854774784, and correcting
70+
** this by subtracting 2 * (long_double) hibit
71+
** (i.e. by adding 2**64 = 18446744073709551616)
72+
** yields 9223372036854776832, which
73+
** rounds to 9223372036854775808
74+
** with a total error of 1535 instead.
75+
** This problem occurs only with very large differences.
76+
** It's too painful to fix this portably.
77+
** We are not alone in this problem;
78+
** some C compilers round twice when converting
79+
** large unsigned types to small floating types,
80+
** so if time_t is unsigned the "return delta" above
81+
** has the same double-rounding problem with those compilers.
82+
*/
83+
returndelta-2* (long_double)hibit;
84+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp