• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

EpochTimeToString.cpp

Go to the documentation of this file.
00001 #include "FormatString.h"
00002 #include "EpochTimeToString.h"
00003 #include <stdio.h>
00004 #include <string.h>
00005 #include <stdarg.h>
00006 // localtime
00007 #include <time.h>
00008 #include "LinuxStrings.h"
00009 
00010 char * EpochTimeToString(long long time)
00011 {
00012         static int textIndex=0;
00013         static char text[4][64];
00014 
00015         if (++textIndex==4)
00016                 textIndex=0;
00017 
00018         struct tm * timeinfo;
00019         time_t t = time;
00020         timeinfo = localtime ( &t );
00021         strftime (text[textIndex],64,"%c.",timeinfo);
00022 
00023         /*
00024         time_t
00025         // Copied from the docs
00026         struct tm *newtime;
00027         newtime = _localtime64(& time);
00028         asctime_s( text[textIndex], sizeof(text[textIndex]), newtime );
00029 
00030         while (text[textIndex][0] && (text[textIndex][strlen(text[textIndex])-1]=='\n' || text[textIndex][strlen(text[textIndex])-1]=='\r'))
00031                 text[textIndex][strlen(text[textIndex])-1]=0;
00032                 */
00033 
00034         return text[textIndex];
00035 }

Generated on Thu Sep 30 2010 01:27:23 for RakNet by  doxygen 1.7.1