summaryrefslogtreecommitdiffstats
path: root/mbbsd/calendar.c
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-13 11:20:04 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-13 11:20:04 +0800
commit6a428fb60d8ec6092d428b2e0f869a31f4890dc7 (patch)
treea0671ea2dc0168a9cb5625f867d553f6d0441efc /mbbsd/calendar.c
parent438c456b95eec0e5ac662ca3cf2386dff2c44bc7 (diff)
downloadpttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.gz
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.bz2
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.lz
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.xz
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.zst
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.zip
replace time(NULL) by now
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@163 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/calendar.c')
-rw-r--r--mbbsd/calendar.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/mbbsd/calendar.c b/mbbsd/calendar.c
index 78ca46cf..371a8f79 100644
--- a/mbbsd/calendar.c
+++ b/mbbsd/calendar.c
@@ -1,4 +1,4 @@
-/* $Id: calendar.c,v 1.1 2002/03/07 15:13:48 in2 Exp $ */
+/* $Id: calendar.c,v 1.2 2002/05/13 03:20:04 ptt Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -9,6 +9,7 @@
#include "proto.h"
#include "modes.h"
+extern time_t now;
typedef struct event_t {
int year, month, day, days;
int color;
@@ -232,16 +233,14 @@ static int GenerateCalendar(char **buf, int y, int m, int today, event_t *e) {
int calendar() {
char **buf;
- time_t t;
- struct tm now;
+ struct tm snow;
int i, y, m, today, lines = 0;
event_t *head = NULL, *e = NULL;
/* initialize date */
- time(&t);
- memcpy(&now, localtime(&t), sizeof(struct tm));
- today = Days(now.tm_year + 1900, now.tm_mon + 1, now.tm_mday);
- y = now.tm_year + 1900, m = now.tm_mon + 1;
+ memcpy(&snow, localtime(&now), sizeof(struct tm));
+ today = Days(snow.tm_year + 1900, snow.tm_mon + 1, snow.tm_mday);
+ y = snow.tm_year + 1900, m = snow.tm_mon + 1;
/* read event */
head = e = ReadEvent(today);
@@ -265,10 +264,10 @@ int calendar() {
outs(buf[i]);
if(i == 0) {
prints("\t\33[1;37m²{¦b¬O %d.%02d.%02d %2d:%02d:%02d%cm\33[m",
- now.tm_year + 1900, now.tm_mon + 1, now.tm_mday,
- (now.tm_hour == 0 || now.tm_hour == 12) ?
- 12 : now.tm_hour % 12, now.tm_min, now.tm_sec,
- now.tm_hour >= 12 ? 'p' : 'a');
+ snow.tm_year + 1900, snow.tm_mon + 1, snow.tm_mday,
+ (snow.tm_hour == 0 || snow.tm_hour == 12) ?
+ 12 : snow.tm_hour % 12, snow.tm_min, snow.tm_sec,
+ snow.tm_hour >= 12 ? 'p' : 'a');
} else if(i >= 2 && e) {
prints("\t\33[1;37m(\33[%dm%3d\33[37m)\33[m %02d/%02d %s",
e->color, e->days - today,