~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/mf_getdate.cc

  • Committer: Monty Taylor
  • Date: 2010-12-24 02:13:05 UTC
  • mto: This revision was merged to the branch mainline in revision 2038.
  • Revision ID: mordred@inaugust.com-20101224021305-e3slv1cyjczqorij
Changed the bzrignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
16
/* Get date in a printable form: yyyy-mm-dd hh:mm:ss */
17
17
 
18
 
#include "mysys_priv.h"
19
 
#include <mystrings/m_string.h>
20
 
#include <stdio.h>
 
18
#include "config.h"
 
19
 
 
20
#include "drizzled/internal/my_sys.h"
 
21
#include "drizzled/internal/m_string.h"
 
22
#include <cstdio>
 
23
 
 
24
namespace drizzled
 
25
{
 
26
namespace internal
 
27
{
21
28
 
22
29
/*
23
30
  get date as string
39
46
{
40
47
   register struct tm *start_time;
41
48
   time_t skr;
42
 
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
43
 
  struct tm tm_tmp;
44
 
#endif
 
49
   struct tm tm_tmp;
45
50
 
46
 
   skr=date ? (time_t) date : my_time(0);
47
 
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
 
51
   skr= date ? (time_t) date : time(0);
48
52
   if (flag & GETDATE_GMT)
49
53
     localtime_r(&skr,&tm_tmp);
50
54
   else
51
55
     gmtime_r(&skr,&tm_tmp);
52
56
   start_time= &tm_tmp;
53
 
#else
54
 
   if (flag & GETDATE_GMT)
55
 
     start_time= localtime(&skr);
56
 
   else
57
 
     start_time= gmtime(&skr);
58
 
#endif
59
57
   if (flag & GETDATE_SHORT_DATE)
60
58
     sprintf(to,"%02d%02d%02d",
61
59
             start_time->tm_year % 100,
80
78
             start_time->tm_min,
81
79
             start_time->tm_sec);
82
80
} /* get_date */
 
81
 
 
82
} /* namespace internal */
 
83
} /* namespace drizzled */