This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/orc.git


The following commit(s) were added to refs/heads/main by this push:
     new ce84966  ORC-1068: [C++] Stabilize HAS_POST_2038 test (#980)
ce84966 is described below

commit ce84966a3322fd39904363c51bca418da134fd10
Author: Yuriy Chernyshov <[email protected]>
AuthorDate: Wed Dec 29 12:23:44 2021 +0300

    ORC-1068: [C++] Stabilize HAS_POST_2038 test (#980)
    
    On my machine (Ubuntu Focal 20.04.3, libc6=2.31-0ubuntu9.2, 
tzdata=2021e-0ubuntu0.20.04) the following results are returned by strptime:
    
    ```
    time2037.tm_hour = 13; // weird
    time2038.tm_hour = 12; // correct
    ```
    
    This results in time difference 31532400 (which is 3600 less than 
expected). Some other configurations give the expected result, thus making the 
build variable to flap during sequential builds on different systems.
    
    Since this is just a basic test, I suggest relaxing it a bit in order to 
make it stable.
---
 c++/src/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt
index ccb48da..d4cd035 100644
--- a/c++/src/CMakeLists.txt
+++ b/c++/src/CMakeLists.txt
@@ -157,7 +157,7 @@ CHECK_CXX_SOURCE_RUNS("
       struct tm time2038;
       strptime(\"2037-05-05 12:34:56\", \"%Y-%m-%d %H:%M:%S\", &time2037);
       strptime(\"2038-05-05 12:34:56\", \"%Y-%m-%d %H:%M:%S\", &time2038);
-      return mktime(&time2038) - mktime(&time2037) != 31536000;
+      return (mktime(&time2038) - mktime(&time2037)) <= 31500000;
     }"
   HAS_POST_2038
 )

Reply via email to