11#
2- # Copyright (c) 2011, 2021 , Oracle and/or its affiliates. All rights reserved.
2+ # Copyright (c) 2011, 2022 , Oracle and/or its affiliates. All rights reserved.
33# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44#
55# This code is free software; you can redistribute it and/or modify it
@@ -230,8 +230,6 @@ AC_DEFUN([UTIL_GET_MATCHING_VALUES],
230230# Converts an ISO-8601 date/time string to a unix epoch timestamp. If no
231231# suitable conversion method was found, an empty string is returned.
232232#
233- # Sets the specified variable to the resulting list.
234- #
235233# $1: result variable name
236234# $2: input date/time string
237235AC_DEFUN ( [ UTIL_GET_EPOCH_TIMESTAMP] ,
@@ -241,11 +239,11 @@ AC_DEFUN([UTIL_GET_EPOCH_TIMESTAMP],
241239 timestamp=$($DATE --utc --date=$2 +"%s" 2> /dev/null)
242240 else
243241 # BSD date
244- timestamp=$($DATE -u -j -f "%F %T " "$2 " "+%s" 2> /dev/null)
242+ timestamp=$($DATE -u -j -f "%FZ %TZ " "$2 " "+%s" 2> /dev/null)
245243 if test "x$timestamp" = x; then
246- # Perhaps the time was missing
247- timestamp=$($DATE -u -j -f "%F %T" " $2 00:00:00" "+%s" 2> /dev/null)
248- # If this did not work, we give up and return the empty string
244+ # BSD date cannot handle trailing milliseconds.
245+ # Try again ignoring characters at end
246+ timestamp=$($DATE -u -j -f "%Y-%m-%dT%H:%M:%S" " $2 " "+%s" 2> /dev/null)
249247 fi
250248 fi
251249 $1 =$timestamp
0 commit comments