6
* Copyright 2008-10 MetaEmotion S.L. All rights reserved.
7
* http://ginkgo-cadx.com
9
* This file is licensed under LGPL v3 license.
10
* See License.txt for details
14
#include <api/globals.h>
17
inline void GNC::CheckExpiration()
19
const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
20
"Sep", "Oct", "Nov", "Dec"};
21
char temp [] = GINKGO_EXPIRATION_START;
25
struct tm tmCompilacion;
26
tmCompilacion.tm_hour = 0;
27
tmCompilacion.tm_isdst = 0;
28
tmCompilacion.tm_min = 0;
29
tmCompilacion.tm_sec = 0;
30
tmCompilacion.tm_wday = 0;
31
tmCompilacion.tm_yday = 0;
33
tmCompilacion.tm_year = atoi(temp + 7)-1900;
35
tmCompilacion.tm_mday = atoi(temp + 4);
37
for (i = 0; i < 12; i++)
39
if (!strcmp(temp, months[i]))
41
tmCompilacion.tm_mon = i;
46
time_t compilacion = mktime(&tmCompilacion);
50
double diferencia = difftime(actual,compilacion);
52
int dias = diferencia/(86400);
54
if ( GINKGO_EXPIRATION_DAYS < dias) {
56
sprintf_s(mensaje,"Licencia desde hace %d dias",(GINKGO_EXPIRATION_DAYS - dias));
57
throw LicenseException(mensaje);
62
inline const std::string GNC::GetFormattedExpirationDate()
64
if (GINKGO_EXPIRATION_DAYS > 0) {
65
const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
66
"Sep", "Oct", "Nov", "Dec"};
67
char temp [] = GINKGO_EXPIRATION_START;
71
struct tm tmCompilacion;
72
tmCompilacion.tm_hour = 0;
73
tmCompilacion.tm_isdst = 0;
74
tmCompilacion.tm_min = 0;
75
tmCompilacion.tm_sec = 0;
76
tmCompilacion.tm_wday = 0;
77
tmCompilacion.tm_yday = 0;
79
tmCompilacion.tm_year = atoi(temp + 7)-1900;
81
tmCompilacion.tm_mday = atoi(temp + 4);
83
for (i = 0; i < 12; i++)
85
if (!strcmp(temp, months[i]))
87
tmCompilacion.tm_mon = i;
92
time_t compilacion = mktime(&tmCompilacion);
93
double expiration = compilacion + (GINKGO_EXPIRATION_DAYS * 86400);
94
char fechaExpiracion[100];
95
compilacion = (time_t)expiration;
96
struct tm* tmExpiracion = localtime_s(&compilacion);
98
strftime(fechaExpiracion,100,"%d/%m/%Y",tmExpiracion);
99
return fechaExpiracion;