diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2011-11-14 02:34:26 +0000 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2011-11-14 02:34:26 +0000 |
commit | bd74d664ca2438c73277623fcbdd956a6981160e (patch) | |
tree | d070f026f2e8e7a327d793a139ecec9f4223ab6b | |
parent | 882643c1377fb19a3f77dcb6ab250bc3a27dbb08 (diff) | |
download | verteco-bd74d664ca2438c73277623fcbdd956a6981160e.tar.gz |
Add crude intervalid.
Diffstat (limited to '')
-rw-r--r-- | interval.txt | 1 | ||||
-rw-r--r-- | modbuslog.c | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/interval.txt b/interval.txt new file mode 100644 index 0000000..368f89c --- /dev/null +++ b/interval.txt @@ -0,0 +1 @@ +28
\ No newline at end of file diff --git a/modbuslog.c b/modbuslog.c index c2b34b7..d664c2f 100644 --- a/modbuslog.c +++ b/modbuslog.c @@ -260,10 +260,19 @@ int main(int argc, char *argv[]) { struct tm utc = *gmtime(&unixtime_min); struct tm lc = *localtime(&unixtime_min); + + int intervalvalue; + FILE *intervalfile = fopen("interval.txt", "w+"); + fscanf(intervalfile, "%d", &intervalvalue); + intervalvalue++; + fprintf(intervalfile, "%d", intervalvalue); + fclose(intervalfile); + + fprintf( filehandle, - "1|%04i%02i%02i|%02i%02i%02i|%04i%02i%02i|%02i%02i%02i|%i|%i|%i\n", - utc.tm_year + 1900, utc.tm_mon + 1, utc.tm_mday, + "%i|%04i%02i%02i|%02i%02i%02i|%04i%02i%02i|%02i%02i%02i|%i|%i|%i\n", + intervalvalue,utc.tm_year + 1900, utc.tm_mon + 1, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec, lc.tm_year + 1900, lc.tm_mon + 1, lc.tm_mday, lc.tm_hour, lc.tm_min, lc.tm_sec, slaveid, startaddress, registervalue); |