Fix symlinks
[anna.git] / source / dbms / TimeStamp.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #include <stdio.h>
10
11 #include <anna/dbms/TimeStamp.hpp>
12
13 #include <anna/config/defines.hpp>
14 #include <anna/core/functions.hpp>
15
16 using namespace std;
17 using namespace anna;
18 using namespace anna::dbms;
19
20 const char* dbms::TimeStamp::getCStringValue() const
21 throw() {
22   const char* format;
23
24   if((format = a_format) == NULL)
25     format = "%d/%m/%Y %H:%M:%S.%%d";
26
27   TimeStamp* _this = const_cast <TimeStamp*>(this);
28   char* result = _this->a_buffer;
29
30   if(strftime(result, MaxDateSize, format, &a_value) == 0)
31     return NULL;
32
33   if(anna_strstr(result, "%d")) {
34     anna_strcpy(_this->a_anotherBuffer, result);
35     sprintf(result, _this->a_anotherBuffer, a_fractionalSecond);
36   }
37
38   return result;
39 }