
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <time.h>
#include "cwg-shared.h"

#define SAMPLE_PERIOD_SEC 600
#define SAMPLES_PER_PERIOD 2
#define SAMPLES_PER_HOUR (SAMPLES_PER_PERIOD*3600UL/SAMPLE_PERIOD_SEC)
#define SAMPLES_PER_DAY (SAMPLES_PER_HOUR*24)
#define LOG_DAYS 30
#define MEAS_COUNT 6

int main(int argc, char **argv)
{
    bool use_bad=true;

    uint32_t i=0;
    int x=0;
    for(x=1;x<argc;x++)
        if(argv[x][0]=='g')use_bad=false;

    time_t tt_now=time(NULL);
    struct tm tm_now;
    gmtime_r(&tt_now,&tm_now);
    tt_now=mktime(&tm_now);
    uint64_t tems=1000LLU*tt_now;

    tems=1583975011000;
    uint32_t record_count=LOG_DAYS*SAMPLES_PER_DAY;
    g_dprint=true;
    char *tstr=NULL;
    for(i=0;i<record_count;i++){
        if(use_bad){
        	tems+=(uint64_t)(1000LLU*i*SAMPLE_PERIOD_SEC/SAMPLES_PER_PERIOD);
        }else{
            tems+=(uint64_t)(1000LLU*SAMPLE_PERIOD_SEC/SAMPLES_PER_PERIOD);
        }
        if( (i%100) == 0){
            tstr =striso8601(NULL, tems, ISO8601_PREC_SEC);
            DPRINT("%8d - %14"FMT_U64" / %s\r\n",i,tems,tstr);
        }
    }
    tstr =striso8601(NULL, tems, ISO8601_PREC_SEC);
    DPRINT("%8d - %14"FMT_U64" / %s\r\n",i,tems,tstr);

    return 0;
}
