#ifndef Time_H_
#define Time_H_
#include "foundation/TnTypes.h"
#include <time.h>

#pragma message("'foundation/TnTime.h' is deprecated. Use <ctime> or 'foundation/simple_time.hpp' instead.")

namespace Tn
{
    namespace Foundation
    {
        class Time
        {
            public:
                /**
                *Get time from startup, in milli-seconds
                *@return time in milli-seconds
                */
                virtual int timeInMs() = 0;
                
                virtual clock_t clock(void) = 0;
                /**
                 * @brief Convert tm to a string
                 * Convert tm to a string in the format "Www Mmm dd hh:mm:ss yyyy", 
                 * where Www is the weekday, Mmm the month in letters, dd the day 
                 * of the month, hh:mm:ss the time, and yyyy the year. The string 
                 * is followed by a newline and a terminating null character, 
                 *                                                                 c
                 * @Param tmptr the time to convert
                 *
                 * @Returns   string converted
                 */
                virtual char* asctime(const struct tm* tmptr) = 0;

                /**
                 * @brief Convert time to a string
                 *
                 * Convert time_t value to string in the same format as asctime.
                 *
                 * @Param timer the time to convert
                 *
                 * @Returns  string converted. 
                 */
                virtual char* ctime(const time_t* timer) = 0;

                /**
                 * @brief the difference in seconds between the two times.
                 *
                 * @Param timer2 first time
                 * @Param timer1 second time
                 *
                 * @Returns   the difference in seconds between the two times.
                 */
                virtual double difftime(time_t timer2, time_t timer1) = 0;

                /**
                 * @brief Convert a time_t value to a tm structure as UTC time.
                 *
                 * @Param time the time to convert
                 *
                 * @Returns  tm struct converted. 
                 */
                virtual struct tm* gmtime(const time_t* time) = 0;

                /**
                 * @brief Convert a time_t value to a tm structure as local time. 
                 *
                 * @Param time the time to convert
                 *
                 * @Returns   tm struct converted.
                 */
                virtual struct tm* localtime(const time_t* time) = 0;

                /**
                 * @brief the unix timestamp corresponding to the arguments given.
                 *
                 * Returns the Unix timestamp corresponding to the arguments given. 
                 * This timestamp is a long integer containing the number of seconds between the Unix Epoch
                 * (January 1 1970 00:00:00 GMT) and the time specified. 
                 *
                 * @Param tptr the tm 
                 *
                 * @Returns  the unix timestamp 
                 */
                virtual time_t mktime(struct tm *tptr) = 0;

                /**
                 * @brief Get Current Time
                 *
                 * Get the current time from the system clock. Stores that value in timer.  
                 * If timer is null, the value is not stored, but it is still returned by the function.
                 *
                 * @Param timer
                 *
                 * @Returns   
                 */
                virtual time_t time(time_t* timer) = 0;

                /**
                 * @brief Format tm into a date/time string
                 *
                 * @Param s
                 * @Param maxs
                 * @Param f
                 * @Param t
                 *
                 * @Returns   
                 */
                virtual size_t strftime(char *s, size_t maxs, const char *f, const struct tm *t) = 0;
                
                virtual ~Time(){}

        }; //end of class Time
    }; //end of namespace foundation
}; //end of namespace tn

#endif
