]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
Revert "fix tests with local time"
authorBastian Dehn <hhaalo@arcor.de>
Tue, 11 Jun 2024 17:26:25 +0000 (19:26 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Tue, 11 Jun 2024 17:26:25 +0000 (19:26 +0200)
This reverts commit ed9fab8407e291106f218768c1fd1fc67cf3354f.

src/main.c
src/time_format.c
tests/time_format_tests.c

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