crossroads

Git mirror of https://crossroads.e-tunity.com/
git clone git://git.finwo.net/app/crossroads
Log | Files | Refs

ansistamp.c (780B)


      1 /*************************************************************************
      2  * This file is part of Crosroads 1.23, a load balancer and fail over
      3  * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL.
      4  * Visit http://crossroads.e-tunity.com for information.
      5  *************************************************************************/
      6 #include "crossroads.h"
      7 
      8 char *ansistamp (TmType t) {
      9     static char buf[80];
     10     time_t now;
     11     struct tm *tmp;
     12 
     13     time (&now);
     14     if (t == tm_localtime)	
     15 	tmp = localtime (&now);
     16     else
     17 	tmp = gmtime (&now);
     18     
     19     snprintf (buf, sizeof(buf),
     20 	      "%4.4d-%2.2d-%2.2d/%2.2d:%2.2d:%2.2d",
     21 	      tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
     22 	      tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
     23     
     24     return (buf);
     25 }