Fixed some date and time conversion functions
[AXE.git] / src / date.cpp
index 5094fca..5213fce 100644 (file)
@@ -5,7 +5,7 @@
 ***********************
 **      FILE NAME      : date.cpp
 **      SYSTEM NAME    : AXE - Andromeda X-windows Encapsulation
-**      VERSION NUMBER : $Revision: 1.1 $
+**      VERSION NUMBER : $Revision: 1.2 $
 **
 **  DESCRIPTION      :  
 **
 
 /*****************************
    $Log: date.cpp,v $
-   Revision 1.1  2002-07-25 08:01:26  arjen
+   Revision 1.2  2002-09-02 06:18:20  arjen
+   Fixed some date and time conversion functions
+
+   Revision 1.1  2002/07/25 08:01:26  arjen
    First checkin, AXE release 0.2
 
 *****************************/
 
-static const char *RCSID = "$Id: date.cpp,v 1.1 2002-07-25 08:01:26 arjen Exp $";
+static const char *RCSID = "$Id: date.cpp,v 1.2 2002-09-02 06:18:20 arjen Exp $";
 
 #include <iostream> 
 #include <time.h>
@@ -307,16 +310,15 @@ String date::MonthName(void)
 String date::format(const char *fmt)
 {
    String  s;
-   //char    buf[40];
+   char    buf[40];
    struct  tm  t;
 
-   t.tm_year = year;
-   t.tm_mon  = month;
+   t.tm_year = year - 1900;
+   t.tm_mon  = month - 1;
    t.tm_mday = day;
 
-   s = String(int(day)) + String(" ") + MonthName() + String(" ") + String(year);
-   //strftime(buf, 40, fmt, &t);
-   //s = buf;
+   strftime(buf, 40, fmt, &t);
+   s = buf;
 
    return s;
 }