Changeset 131 for trunk/src/sh_html.c


Ignore:
Timestamp:
Oct 22, 2007, 11:19:15 PM (17 years ago)
Author:
rainer
Message:

Use thread-safe libc functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_html.c

    r34 r131  
    3434#endif
    3535#endif
     36#include <unistd.h>
    3637
    3738
     
    9091  time_t    now;
    9192  struct tm   * time_ptr;
     93#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_LOCALTIME_R)
     94  struct tm    time_tm;
     95#endif
    9296
    9397  char    * formatted;
     
    148152      if (!SL_ISERROR(status))
    149153        {
     154#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_LOCALTIME_R)
     155          time_ptr   = localtime_r (&(server_status.start), &time_tm);
     156#else
    150157          time_ptr   = localtime (&(server_status.start));
     158#endif
    151159          if (time_ptr != NULL)
    152160            status = strftime (ts1, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr);
    153161          now = time(NULL);
     162#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_LOCALTIME_R)
     163          time_ptr   = localtime_r (&now, &time_tm);
     164#else
    154165          time_ptr   = localtime (&now);
     166#endif
    155167          if (time_ptr != NULL)
    156168            status = strftime (ts2, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr);
     
    174186          if (server_status.last > (time_t) 0)
    175187            {
     188#if defined(HAVE_PTHREAD) && defined (_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_LOCALTIME_R)
     189              time_ptr   = localtime_r (&(server_status.last), &time_tm);
     190#else
    176191              time_ptr   = localtime (&(server_status.last));
     192#endif
    177193              if (time_ptr != NULL)
    178194                status = strftime (ts1, 80, _("%d-%m-%Y %H:%M:%S"), time_ptr);
Note: See TracChangeset for help on using the changeset viewer.