#ifndef _MSL_CTIME
#define _MSL_CTIME

#include <ansi_params.h>

#if !_MSL_USING_MW_C_HEADERS
    #include <time.h>

    #if _MSL_PUT_THIRD_PARTY_C_IN_STD
        #include <msl_cpp_std_time.h>
    #endif
#elif defined(__PALMOS_TRAPS__)
    #include <ctime_Palm_OS>
#else

#include <null.h>
#include <size_t.h>
#include <msl_secure.h>
#include <msl_rsize_t.h>

#ifndef RC_INVOKED

#if defined(__m56800__) || defined(__m56800E__)
    #include <time.56800.h>
#endif

#pragma options align=native

_MSL_BEGIN_NAMESPACE_STD
    _MSL_BEGIN_EXTERN_C

#if _MSL_CLOCK_T_AVAILABLE
    #ifndef _MSL_CLOCKS_PER_SEC
        #define _MSL_CLOCKS_PER_SEC 60
    #endif

    #ifndef _MSL_CLOCK_T
        #define _MSL_CLOCK_T unsigned long
    #endif

    #define CLOCKS_PER_SEC _MSL_CLOCKS_PER_SEC

    #ifndef  _MSL_CLOCK_T_DEFINED
typedef _MSL_CLOCK_T clock_t;
        #define _MSL_CLOCK_T_DEFINED
    #endif
#endif

#if _MSL_TIME_T_AVAILABLE
    #ifndef _MSL_TIME_T_DEFINED
typedef long time_t;
        #define _MSL_TIME_T_DEFINED

        #define _TIME_T_DEFINED
    #endif
#endif

#if _MSL_TM_STRUCT_AVAILABLE
struct tm {
    int tm_sec;
    int tm_min;
    int tm_hour;
    int tm_mday;
    int tm_mon;
    int tm_year;
    int tm_wday;
    int tm_yday;
    int tm_isdst;
};
#endif

#if _MSL_OS_TIME_SUPPORT

_MSL_IMP_EXP_C clock_t _MSL_CDECL clock(void) _MSL_CANT_THROW;
_MSL_IMP_EXP_C time_t _MSL_CDECL time(time_t *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C struct tm * _MSL_CDECL gmtime(const time_t *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C time_t _MSL_CDECL mktime(struct tm *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C char * _MSL_CDECL asctime(const struct tm *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C char * _MSL_CDECL ctime(const time_t *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C struct tm * _MSL_CDECL localtime(const time_t *) _MSL_CANT_THROW;

#if defined(__STDC_WANT_SECURE_LIB__) && __STDC_WANT_SECURE_LIB__
_MSL_IMP_EXP_C errno_t _MSL_CDECL asctime_s(char *, rsize_t, const struct tm *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C errno_t _MSL_CDECL ctime_s(char *, rsize_t, const time_t *) _MSL_CANT_THROW;
_MSL_IMP_EXP_C struct tm * _MSL_CDECL gmtime_s(const time_t * _MSL_RESTRICT, struct tm * _MSL_RESTRICT) _MSL_CANT_THROW;
_MSL_IMP_EXP_C struct tm * _MSL_CDECL localtime_s(const time_t * _MSL_RESTRICT, struct tm * _MSL_RESTRICT) _MSL_CANT_THROW;
#endif

_MSL_IMP_EXP_C size_t _MSL_CDECL strftime(char * _MSL_RESTRICT, size_t, const char * _MSL_RESTRICT, const struct tm * _MSL_RESTRICT) _MSL_CANT_THROW;

#endif

#if _MSL_FLOATING_POINT && _MSL_TIME_T_AVAILABLE
_MSL_IMP_EXP_C double _MSL_CDECL difftime(time_t, time_t) _MSL_CANT_THROW;
#endif

_MSL_END_EXTERN_C
_MSL_END_NAMESPACE_STD

#pragma options align=reset

#if _MSL_NEEDS_EXTRAS
    #include <extras_time.h>
#endif

#endif

#endif

#endif
