
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#include"sitar_scan.h"
#include<almemsys/almemsys.h>


// time_t cert_time_get(char * data);


time_t cert_time_get(char * data)
{
int max, ret;
ret = 0;
time_t dtime;
char y[5]; char o[5]; char d[5]; char h[5]; char m[5]; char s[5];
int iy, io, id, ih, im, is;

memset(y, 0x00, 5);
memset(o, 0x00, 5);
memset(d, 0x00, 5);
memset(h, 0x00, 5);
memset(m, 0x00, 5);
memset(s, 0x00, 5);

max = strlen(data);
if(max < 13){
   ret = -1;
   return ret;
   }

count_memcpy3(y, data, 0, 1);
count_memcpy3(o, data, 2, 1);
count_memcpy3(d, data, 4, 1);
count_memcpy3(h, data, 6, 1);
count_memcpy3(m, data, 8, 1);
count_memcpy3(s, data, 10, 1);

iy = 2000 + (strtol(y, (char **)NULL, 10));
io = strtol(o, (char **)NULL, 10);
id = strtol(d, (char **)NULL, 10);
ih = strtol(h, (char **)NULL, 10);
im = strtol(m, (char **)NULL, 10);
is = strtol(s, (char **)NULL, 10);

dtime = get_unixtime(iy, io, id, ih, im, is);

return dtime;
}




