#include "Mouchard.h" #include "Identifiant.h" #include Mouchard::Mouchard() : Singleton< Mouchard >() { if ( DLL_LIMITEE ) { unsigned long p = (unsigned long)VALEUR_DU_MOUCHARD; int a = (int)( p / 100000 ); int m = (int)( ( p % 100000 ) / 1000 ); time_t ct = time( NULL ); struct tm* ts = localtime( &ct ); struct tm t; t.tm_sec = 0; t.tm_min = 0; t.tm_hour = 0; t.tm_mday = 1; t.tm_mon = m - 1; t.tm_year = a - 1900; t.tm_isdst = ts->tm_isdst; mt = mktime( &t ); } } unsigned long Mouchard::GetMouchard() { return (unsigned long)VALEUR_DU_MOUCHARD; } bool Mouchard::IsDLLValid() { if ( DLL_LIMITEE ) { time_t ct = time( NULL ); if ( ct >= mt ) { return false; } } return true; } std::string Mouchard::GetExpirationDate() { if ( DLL_LIMITEE ) { char buf[ 32 ]; struct tm* ts = localtime( &mt ); strftime( buf, sizeof( buf ), "%d %B %Y", ts ); return buf; } return "Unlimited"; }