Navigation



Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfreeDiameter/log.c

    r22 r2  
    8787}
    8888
    89 /* Write time into a buffer */
    90 char * fd_log_time ( struct timespec * ts, char * buf, size_t len )
     89/* Write current time into a buffer */
     90char * fd_log_time ( char * buf, size_t len )
    9191{
    9292        int ret;
     
    9696       
    9797        /* Get current time */
    98         if (!ts) {
    99                 ret = clock_gettime(CLOCK_REALTIME, &tp);
    100                 if (ret != 0) {
    101                         snprintf(buf, len, "%s", strerror(ret));
    102                         return buf;
    103                 }
    104                 ts = &tp;
     98        ret = clock_gettime(CLOCK_REALTIME, &tp);
     99        if (ret != 0) {
     100                snprintf(buf, len, "%s", strerror(ret));
     101                return buf;
    105102        }
    106103       
    107         offset += strftime(buf + offset, len - offset, "%D,%T", localtime_r( &ts->tv_sec , &tm ));
    108         offset += snprintf(buf + offset, len - offset, ".%6.6ld", ts->tv_nsec / 1000);
     104        offset += strftime(buf + offset, len - offset, "%D,%T", localtime_r( &tp.tv_sec , &tm ));
     105        offset += snprintf(buf + offset, len - offset, ".%6.6ld", tp.tv_nsec / 1000);
    109106
    110107        return buf;
Note: See TracChangeset for help on using the changeset viewer.