aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/modbuslog.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/modbuslog.c b/src/modbuslog.c
index 43d102d..d967e4a 100644
--- a/src/modbuslog.c
+++ b/src/modbuslog.c
@@ -156,7 +156,9 @@ int main(int argc, char *argv[]) {
select(0, NULL, NULL, NULL, NULL);
time_t t = time(NULL);
- time_t unixtime_min = (((int) t) / 60 * 60);
+ struct tm unixtime_min_time_t = *gmtime (&t);
+ unixtime_min_time_t.tm_sec = 0;
+ time_t unixtime_min = mktime(&unixtime_min_time_t);
//int unixtime = (int) t;
//printf("%d\n", unixtime);
@@ -281,9 +283,12 @@ int main(int argc, char *argv[]) {
//MODBUS_SET_INT16_TO_INT8(tab_int8, index, value);
// round forward to next midnight
- time_t unixtime_day = ((((int) t) / 86400 * 86400) + 86400);
-
- struct tm midnight = *localtime(&unixtime_day);
+ struct tm midnight = *localtime(&t);
+ midnight.tm_hour = 0;
+ midnight.tm_min = 0;
+ midnight.tm_sec = 0;
+ midnight.tm_mday += 1;
+ mktime (&midnight);
char log_filename[50];
bian/libconfig.git/commit/debian/control?h=debian/1.4.8-1_exp1&id=ab71bd0a67c76bda955eeeedc51d68d7b09ef17b&follow=1'>Rename libconfig9 to libconfig8 to aid release teamJonathan McCrohan1-14/+14 2012-02-07Fix "closes typo"Jonathan McCrohan1-1/+1 2012-02-07Revert "Add symbols"Jonathan McCrohan3-739/+1 2012-02-07Revert "Fix b0rked symbol file."Jonathan McCrohan1-1/+1 2012-02-07Revert "Second attempt"Jonathan McCrohan2-0/+194 2012-01-29Second attemptJonathan McCrohan2-194/+0 2012-01-29Fix b0rked symbol file.Jonathan McCrohan1-1/+1 2012-01-29Add symbolsJonathan McCrohan3-1/+739 2012-01-26add examples properlyJonathan McCrohan1-0/+2 2012-01-26Update changelogJonathan McCrohan1-3/+6 2012-01-26fix typoJonathan McCrohan1-1/+1 2012-01-26fix accidental description changesJonathan McCrohan1-2/+2 2012-01-26more fucking around to please lintianJonathan McCrohan1-5/+2 2012-01-25Linitan fixesJonathan McCrohan2-3/+2 2012-01-25Split out debug packagesJonathan McCrohan2-1/+6 2011-12-31Fix debian/rulesJonathan McCrohan1-1/+1 2011-12-31Remove shlibsJonathan McCrohan1-2/+0 2011-12-31Remove NMU from changelogJonathan McCrohan1-1/+0 2011-12-31Lintian FixesJonathan McCrohan1-2/+4 2011-12-31Remove Makefile patchJonathan McCrohan1-1/+0 2011-12-31Update MakefilesJonathan McCrohan10-248/+8222 2011-12-31Updated makefilesJonathan McCrohan1-0/+1