void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
BOOL running;
time_t t1;
time(&t1);
running = GetTagBit("StopwatchRunning");
if (running) {
SetTagBit("StopwatchRunning", 0);
SetTagSDWord("StopwatchStoptime" ,(int)t1);
} else {
SetTagBit("StopwatchRunning", 1);
SetTagSDWord("StopwatchStarttime" ,(int)t1);
}
}
char* _main(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
long int t1;
time_t t2;
char *s;
struct tm *timeinfo;
t1 = GetTagSDWord("StopwatchStarttime");
t2 = (time_t)t1;
timeinfo = localtime(&t2);
s = SysMalloc(100);
sprintf(s, "%s", asctime(timeinfo));
return s;
}
double _main(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
BOOL running;
long int t1;
long int tt2;
time_t t2;
running = GetTagBit("StopwatchRunning");
t1 = GetTagSDWord("StopwatchStarttime");
if (running) {
time(&t2);
return (double) ((long int)t2 - t1);
} else {
tt2 = GetTagSDWord("StopwatchStoptime");
return (double) tt2 - t1;
}
}