[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnu-radius-help
Subject:    Re: [Help-gnu-radius] bug in raduse?
From:       Sergey Poznyakoff <gray () Mirddin ! farlep ! net>
Date:       2001-07-26 6:44:40
[Download RAW message or body]

Hello, Wiwin

> do you mean LC_TIME?  it is not set.  Or how can I check what locale I have
> set?

Actually, date/time display in raduse up to version 0.95 relies on
strftime returning fixed format for %c specification. If the underlying
implementation changes this format (e.g. due to the setting of
LC_TIME variable) the effect reported by you is produced. 

The following patch to raduse fixes the problem.

Regards,
Sergey

Index: raduse.c
===================================================================
RCS file: /cvs/gnu-radius/raduse/raduse.c,v
retrieving revision 1.5
diff -p -u -w -b -r1.5 raduse.c
--- raduse.c	2001/07/12 14:00:38	1.5
+++ raduse.c	2001/07/26 06:30:42
@@ -443,14 +443,19 @@ formatdelta(outbuf, delta)
 	char ct[128];
 	char buf[128];
 	struct tm *tm;
+	int days;
 
+	if (delta >= 86400) {
+		days = delta / 86400;
+		delta %= 86400;
+	} else
+		days = 0;
 	tm = gmtime(&delta);
-	strftime(ct, sizeof(ct), "%c", tm);
-	if (delta < 86400)
-		sprintf(buf, "%*.*s", width, width, ct + 11);
+	strftime(ct, sizeof(ct), "%H:%M:%S", tm);
+	if (days == 0)
+		sprintf(buf, "%*.*s", width, width, ct);
 	else
-		sprintf(buf, "%ld+%*.*s",
-			delta / 86400, width, width, ct + 11);
+		sprintf(buf, "%ld+%*.*s", days, width, width, ct);
 	return sprintf(outbuf, "%11.11s ", buf);
 }
 
@@ -463,11 +468,8 @@ formattime(buf, time)
 	char ct[128];
 	
 	tm = localtime(&time);
-	strftime(ct, sizeof(ct), "%c", tm);
-	return sprintf(buf, "%10.10s %5.5s ", ct, ct + 11);
-
-	/*"%m/%d/%y %H:%M:%S", tm);
-	printf("%8.8s %5.5s ", buf, buf + 9);*/
+	strftime(ct, sizeof(ct), "%a %b %e %H:%M", tm);
+	return sprintf(buf, "%s ", ct);
 }
 
 int


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic