ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ctime.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:   LGPL, See LGPL.txt in the top level directory
00003  * PROJECT:     ReactOS CRT library
00004  * FILE:        lib/sdk/crt/time/ctime.c
00005  * PURPOSE:     Implementation of ctime, _ctime_s
00006  * PROGRAMERS:  Timo Kreuzer
00007  */
00008 #define MINGW_HAS_SECURE_API 1
00009 
00010 #define RC_INVOKED 1 // to prevent inline functions
00011 #include <tchar.h>
00012 #include <time.h>
00013 #include "bitsfixup.h"
00014 
00015 #define EINVAL -1
00016 
00017 /* Doesn't really exist, but we need it here */
00018 _CRTIMP errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time);
00019 
00020 /******************************************************************************
00021  * \name _tctime_s
00022  * \brief Converts a time_t value into a string.
00023  * \param buffer Buffer that receives the string (26 characters).
00024  * \param numberOfElements Size of the buffer in characters.
00025  * \param time Pointer to the UTC time.
00026  */
00027 errno_t
00028 _tctime_s(_TCHAR *buffer, size_t numberOfElements, const time_t *time)
00029 {
00030     struct tm _tm;
00031 
00032     if (localtime_s(&_tm, time) == EINVAL)
00033     {
00034         return EINVAL;
00035     }
00036     return _tasctime_s(buffer, numberOfElements, &_tm);
00037 }
00038 
00039 /******************************************************************************
00040  * \name _tctime
00041  * \brief Converts a time_t value into a string and returns a pointer to it.
00042  * \param time Pointer to the UTC time.
00043  * \remarks The string is stored in thread local buffer, shared between
00044  *          ctime, gmtime and localtime (both 32 and 64 bit versions).
00045  */
00046 _TCHAR *
00047 _tctime(const time_t *ptime)
00048 {
00049     struct tm *ptm = localtime(ptime);
00050     if (!ptm)
00051     {
00052         return 0;
00053     }
00054     return _tasctime(ptm);
00055 }
00056 

Generated on Thu May 24 2012 04:37:04 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.