//////////////////////////////////////////////////////////////////////////////
//
// Asura_Platform_Time_System.cpp
//
// Copyright (c) 2006 Rebellion. All rights reserved.
//
//////////////////////////////////////////////////////////////////////////////

// I N C L U D E S ///////////////////////////////////////////////////////////

#include "Core/Asura.h"

// Stdlib independent.
#include <time.h>

// Engine independent.
#include "Core/Asura_Time_System.h"
#include "Debugging/Asura_Assert.h"

// C L A S S   I M P L E M E N T A T I O N S /////////////////////////////////

void Asura_Time_System::Platform_GetCurrentDateAndTime( void )
{
    time_t iSecondsSinceEpoch;
    time( &iSecondsSinceEpoch );

    const tm* pxDateAndTime = localtime( &iSecondsSinceEpoch );

    s_xTime.m_usYear       = static_cast<u_short>( pxDateAndTime->tm_year + 1900 );
    s_xTime.m_ucMonth      = static_cast<u_char>( pxDateAndTime->tm_mon );        
    s_xTime.m_ucDayOfMonth = static_cast<u_char>( pxDateAndTime->tm_mday - 1 );
    s_xTime.m_ucDayOfWeek  = static_cast<u_char>( pxDateAndTime->tm_wday );
    s_xTime.m_ucHour       = static_cast<u_char>( pxDateAndTime->tm_hour );
    s_xTime.m_ucMinute     = static_cast<u_char>( pxDateAndTime->tm_min );
    s_xTime.m_ucSecond     = static_cast<u_char>( pxDateAndTime->tm_sec );
}

int Asura_Time_System::Platform_GetTimeZoneBias( void )
{
    Asura_Assert( false, "Not implemented yet." );
    return 0;
}

void Asura_Time::Platform_FillFromLibCTime( u_int uLibCTime )
{
    Asura_Assert( false, "Not implemented yet." );
}
