aboutsummaryrefslogtreecommitdiffstats
path: root/modbuslog.c
diff options
context:
space:
mode:
Diffstat (limited to 'modbuslog.c')
-rw-r--r--modbuslog.c13
1 files changed, 11 insertions, 2 deletions
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);