#include <time.h>
#include "test_common.h"

time_t how_long = 60 * 60 * 4;	// 4 часа в секундах

int long_ckm_gostr3410_512(int argc, char *argv[]);

int main(int argc, char *argv[])
{
	CK_RV rc = CKR_OK;
    time_t    t_start;
    time_t    t_now;
    struct tm *tm_start;
    struct tm *tm_finish;

    time(&t_start);
    tm_start = localtime(&t_start);
    printf("============== LS11CLOUD long testing started %02d/%02d/%04d at %02d:%02d:%02d ===============\n",
		tm_start->tm_mday,
		tm_start->tm_mon+1,
		tm_start->tm_year+1900,
        tm_start->tm_hour,
        tm_start->tm_min,
        tm_start->tm_sec);

	do {
		sleep_in_msec(10 * 1000);

		rc = long_ckm_gostr3410_512(argc, argv);

		time(&t_now);
	} while (t_now - t_start < how_long); 

	tm_finish = localtime(&t_now);
    printf("============== LS11CLOUD long testing finished %02d/%02d/%04d at %02d:%02d:%02d ===============\n",
		tm_finish->tm_mday,
		tm_finish->tm_mon+1,
		tm_finish->tm_year+1900,
        tm_finish->tm_hour,
        tm_finish->tm_min,
        tm_finish->tm_sec);

    return 0;
}
