aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--interval.txt1
-rw-r--r--modbuslog.c13
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);