help-gnu-radius
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gnu-radius] bug in raduse?


From: Sergey Poznyakoff
Subject: Re: [Help-gnu-radius] bug in raduse?
Date: Thu, 26 Jul 2001 09:44:40 +0300 (EET DST)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]