mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-06 03:46:25 +02:00
Minor changes
This commit is contained in:
parent
268acd0c8e
commit
1028f22e16
1 changed files with 4 additions and 3 deletions
|
@ -56,18 +56,19 @@ int main (int argc, char *argv [])
|
|||
char buffer[255];
|
||||
int power;
|
||||
time_t interval;
|
||||
|
||||
struct timespec power_ts;
|
||||
while(1){
|
||||
interval=INTERVAL(__loginterval);
|
||||
*logfilepath='\0';
|
||||
sprintf(logfilepath,"%s/%ld",__logdir,interval);
|
||||
logptr=fopen(logfilepath,"w");
|
||||
fprintf(logptr,"timestamp,power\n");
|
||||
fprintf(logptr,"timestamp,ns,power\n");
|
||||
// Log current interval
|
||||
while((TIMESTAMP()-interval)<__loginterval){
|
||||
fgets(buffer,255,regptr);
|
||||
power=atoi(buffer);
|
||||
fprintf(logptr,"%ld,%d\n",TIMESTAMP(),power);
|
||||
clock_gettime(CLOCK_REALTIME,&power_ts);
|
||||
fprintf(logptr,"%d,%ld,%d\n",power_ts.tv_sec,power_ts.tv_nsec,power);
|
||||
fseek(regptr,0,SEEK_SET);
|
||||
sleep(1);
|
||||
printf("Tick\n"); fflush(stdout);
|
||||
|
|
Loading…
Add table
Reference in a new issue