~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_getdate.c

  • Committer: Lee
  • Date: 2008-10-30 22:02:01 UTC
  • mto: (572.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 573.
  • Revision ID: lbieber@lbieber-desktop-20081030220201-elb6qprbzpn7c5a4
add my name to the AUTHORS 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/* Get date in a printable form: yyyy-mm-dd hh:mm:ss */
17
17
 
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
 
{
 
18
#include "mysys_priv.h"
 
19
#include <mystrings/m_string.h>
28
20
 
29
21
/*
30
22
  get date as string
46
38
{
47
39
   register struct tm *start_time;
48
40
   time_t skr;
49
 
   struct tm tm_tmp;
 
41
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
 
42
  struct tm tm_tmp;
 
43
#endif
50
44
 
51
 
   skr= date ? (time_t) date : time(0);
 
45
   skr=date ? (time_t) date : my_time(0);
 
46
#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
52
47
   if (flag & GETDATE_GMT)
53
48
     localtime_r(&skr,&tm_tmp);
54
49
   else
55
50
     gmtime_r(&skr,&tm_tmp);
56
51
   start_time= &tm_tmp;
 
52
#else
 
53
   if (flag & GETDATE_GMT)
 
54
     start_time= localtime(&skr);
 
55
   else
 
56
     start_time= gmtime(&skr);
 
57
#endif
57
58
   if (flag & GETDATE_SHORT_DATE)
58
59
     sprintf(to,"%02d%02d%02d",
59
60
             start_time->tm_year % 100,
78
79
             start_time->tm_min,
79
80
             start_time->tm_sec);
80
81
} /* get_date */
81
 
 
82
 
} /* namespace internal */
83
 
} /* namespace drizzled */