| William A. Kennington III | b95905d | 2021-06-02 12:40:56 -0700 | [diff] [blame] | 1 | From 72e0fe484444169007e481c9b33d8f78ebe03674 Mon Sep 17 00:00:00 2001 | 
 | 2 | From: Khem Raj <raj.khem@gmail.com> | 
 | 3 | Date: Thu, 27 May 2021 15:44:10 -0700 | 
 | 4 | Subject: [PATCH] Fix build with libc++ | 
 | 5 |  | 
 | 6 | In libc++ on 32-bit platforms, int64_t is defined as alias of long long. On 64-bit platforms: long. | 
 | 7 |  | 
 | 8 | On the other hand in definition of std::chrono::duration aliases, that you can find here long long is used | 
 | 9 |  | 
 | 10 | Therefore create custom unit to avoid incompatibility between libstdc++ | 
 | 11 | and libc++ | 
 | 12 |  | 
 | 13 | Upstream-Status: Pending | 
 | 14 |  | 
 | 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 
 | 16 | --- | 
 | 17 |  extensions/expression-language/Expression.cpp | 3 ++- | 
 | 18 |  1 file changed, 2 insertions(+), 1 deletion(-) | 
 | 19 |  | 
 | 20 | diff --git a/extensions/expression-language/Expression.cpp b/extensions/expression-language/Expression.cpp | 
 | 21 | index a25e1d3f..68d6320c 100644 | 
 | 22 | --- a/extensions/expression-language/Expression.cpp | 
 | 23 | +++ b/extensions/expression-language/Expression.cpp | 
 | 24 | @@ -629,7 +629,8 @@ Value expr_toDate(const std::vector<Value> &args) { | 
 | 25 |  #endif  // EXPRESSION_LANGUAGE_USE_DATE | 
 | 26 |   | 
 | 27 |  Value expr_now(const std::vector<Value> &args) { | 
 | 28 | -  return Value(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count()); | 
 | 29 | +  using Milliseconds = std::chrono::duration<std::int64_t, std::chrono::milliseconds::period>; | 
 | 30 | +  return Value(std::chrono::duration_cast<Milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count()); | 
 | 31 |  } | 
 | 32 |   | 
 | 33 |  Value expr_unescapeCsv(const std::vector<Value> &args) { | 
 | 34 | --  | 
 | 35 | 2.31.1 | 
 | 36 |  |