mirror of
https://gitlab.com/manzerbredes/ina260-zmq-publisher.git
synced 2025-04-07 04:16:26 +02:00
Minor changes
This commit is contained in:
parent
5056c06360
commit
3da360332b
3 changed files with 34 additions and 0 deletions
0
jean
Normal file
0
jean
Normal file
|
@ -5,11 +5,42 @@
|
||||||
#include <zmq.h>
|
#include <zmq.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
// Global:
|
||||||
|
char *__logdir;
|
||||||
|
int __loginterval;
|
||||||
|
|
||||||
int main (int argc, char *argv [])
|
int main (int argc, char *argv [])
|
||||||
{
|
{
|
||||||
|
if(argc != 3){
|
||||||
|
printf("Usage: %s <abslogdir> <loginterval>",argv[0]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//----- Init global variables
|
||||||
|
__logdir=argv[1];
|
||||||
|
__loginterval=atoi(argv[2]);
|
||||||
|
|
||||||
|
DIR *dr = opendir(__logdir);
|
||||||
|
struct dirent *de; // Pointer for directory entry
|
||||||
|
for(int i=0;i<0;i++){
|
||||||
|
int interval=INTERVAL(__loginterval);
|
||||||
|
int interval_next=INTERVAL_NEXT(__loginterval);
|
||||||
|
while ((de = readdir(dr)) != NULL){
|
||||||
|
if(strcmp(de->d_name,".") && strcmp(de->d_name,"..")){
|
||||||
|
char *client=de->d_name;
|
||||||
|
printf("aa%s\n",client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
// Prepare our context and publisher
|
// Prepare our context and publisher
|
||||||
void *context = zmq_ctx_new ();
|
void *context = zmq_ctx_new ();
|
||||||
void *publisher = zmq_socket (context, ZMQ_PUB);
|
void *publisher = zmq_socket (context, ZMQ_PUB);
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
#define INTERVAL(duration)\
|
#define INTERVAL(duration)\
|
||||||
((TIMESTAMP()) - ((TIMESTAMP())%(duration)))
|
((TIMESTAMP()) - ((TIMESTAMP())%(duration)))
|
||||||
|
|
||||||
|
#define INTERVAL_NEXT(duration)\
|
||||||
|
((INTERVAL(duration))+(duration))
|
||||||
|
|
||||||
#define INTERVAL_LAST(duration)\
|
#define INTERVAL_LAST(duration)\
|
||||||
(INTERVAL(INTERVAL((TIMESTAMP()),(duration))-1,(duration)))
|
(INTERVAL(INTERVAL((TIMESTAMP()),(duration))-1,(duration)))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue