~ubuntu-branches/debian/squeeze/ntp/squeeze

« back to all changes in this revision

Viewing changes to libntp/humandate.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2010-05-24 11:09:51 UTC
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20100524110951-38j8b4ahc6bvnf1t
Tags: upstream-4.2.6.p1+dfsg
ImportĀ upstreamĀ versionĀ 4.2.6.p1+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
char *
16
16
humanlogtime(void)
17
17
{
18
 
        char *bp;
19
 
        time_t cursec = time((time_t *) 0);
20
 
        struct tm *tm;
 
18
        char *          bp;
 
19
        time_t          cursec;
 
20
        struct tm *     tm;
21
21
        
 
22
        cursec = time(NULL);
22
23
        tm = localtime(&cursec);
23
24
        if (!tm)
24
25
                return "-- --- --:--:--";
25
26
 
26
27
        LIB_GETBUF(bp);
27
28
        
28
 
        (void) sprintf(bp, "%2d %s %02d:%02d:%02d",
29
 
                       tm->tm_mday, months[tm->tm_mon],
30
 
                       tm->tm_hour, tm->tm_min, tm->tm_sec);
 
29
        snprintf(bp, LIB_BUFLENGTH, "%2d %s %02d:%02d:%02d",
 
30
                 tm->tm_mday, months[tm->tm_mon],
 
31
                 tm->tm_hour, tm->tm_min, tm->tm_sec);
31
32
                
32
33
        return bp;
33
34
}