blob: a36973d4be287838ec3deee00a9867e36fb4b151 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
--- xcalendar.c.dist Tue Jul 4 06:59:01 1995
+++ xcalendar.c Mon Mar 12 20:53:10 2001
@@ -1091,10 +1091,10 @@
struct tm *
gettime()
{
- struct timeval t;
+ time_t now;
- gettimeofday(&t, NULL);
- today = localtime(&t.tv_sec);
+ (void) time(&now);
+ today = localtime(&now);
return today;
}
@@ -1827,8 +1827,8 @@
*sb++ = '1', *sb++ = '9';
/* fall thru */
case 'y':
- *sb++ = tm.tm_year / 10 + '0';
- *sb++ = tm.tm_year % 10 + '0';
+ *sb++ = (tm.tm_year%100) / 10 + '0';
+ *sb++ = (tm.tm_year%100) % 10 + '0';
break;
case '%':
*sb++ = *p;
@@ -1869,6 +1869,13 @@
if (len == -1)
return;
}
+
+ /* terminate `buf' with NULL */
+ if (sizeof(buf) == len) {
+ buf = XtRealloc(buf, len + 1);
+ }
+ buf[len] = NULL;
+
start = buf;
while (len > 0) {
|