]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
fix tests with local time
authorBastian Dehn <hhaalo@arcor.de>
Mon, 10 Jun 2024 14:28:41 +0000 (16:28 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 10 Jun 2024 14:28:41 +0000 (16:28 +0200)
src/main.c
src/time_format.c
tests/time_format_tests.c

index b30eafd1f5780a2b2c194a79c28a7a19db485a18..c7109ee74e253829312a1fc8af0b8857ae25888a 100644 (file)
@@ -24,7 +24,7 @@ int main(int argc, char* argv[])
 
        time(&begin);
        localtime_r(&begin, &begin_tm);
-       begin_tm.tm_hour = atoi(argv[1]) + begin_tm.tm_gmtoff / ONE_HOUR;
+       begin_tm.tm_hour = atoi(argv[1]);
        begin_tm.tm_min = atoi(argv[2]);
        begin = mktime(&begin_tm);
 
index 90517cac8d7538ec107a5157b417232fcb50269b..4b4806ad90b24c513af8c410adc4c7cf3020272c 100644 (file)
@@ -7,12 +7,12 @@ void get_time_str(time_t time, char* timestr)
 
        if (time < 0) {
                time *= -1;
-               gmtime_r(&time, &time_cal);
+               localtime_r(&time, &time_cal);
                sprintf(timestr, "-%02d:%02d", time_cal.tm_hour, time_cal.tm_min);
                return;
        }
 
-       gmtime_r(&time, &time_cal);
+       localtime_r(&time, &time_cal);
        sprintf(timestr, "%02d:%02d", time_cal.tm_hour, time_cal.tm_min);
 }
 
index d0b20d7800915531de3e41d002db1d2fa18cec23..4933ada3b840f202305d61ffb664c9bbde73c763 100644 (file)
@@ -9,7 +9,7 @@
 
 void get_zero_hour_and_fifteen_minutes()
 {
-       time_t time = 900;
+       time_t time = 83700;
        char* timestring = malloc(sizeof(char) * 7);
        memset(timestring, 0, 7);
 
@@ -23,7 +23,7 @@ void get_zero_hour_and_fifteen_minutes()
 
 void get_five_hour_fourty_five()
 {
-       time_t time = 20700;
+       time_t time = 103500;
        char* timestring = malloc(sizeof(char) * 7);
        memset(timestring, 0, 7);
 
@@ -37,7 +37,7 @@ void get_five_hour_fourty_five()
 
 void get_minus_five_minutes()
 {
-       time_t time = -300;
+       time_t time = -83100;
        char* timestring = malloc(sizeof(char) * 7);
        memset(timestring, 0, 7);