Skip to content

Commit 77744e8

Browse files
knorth55k-okada
authored andcommitted
use nanosec for travis times
1 parent 25d9cfb commit 77744e8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.travis.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ set -e
44
export DEBIAN_FRONTEND=noninteractive
55

66
function travis_time_start {
7-
TRAVIS_START_TIME=$(date +%s)
7+
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
8+
TRAVIS_START_TIME=$(( $(date +%s)*1000000000 ))
9+
else
10+
TRAVIS_START_TIME=$(date +%s%N)
11+
fi
812
TRAVIS_TIME_ID=$(cat /dev/urandom | LC_ALL=C LC_CTYPE=C tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
913
TRAVIS_FOLD_NAME=$1
1014
echo -e "\e[0Ktravis_fold:start:$TRAVIS_FOLD_NAME"
@@ -14,7 +18,11 @@ function travis_time_start {
1418
function travis_time_end {
1519
set +x # disable debug information
1620
_COLOR=${1:-32}
17-
TRAVIS_END_TIME=$(date +%s)
21+
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
22+
TRAVIS_END_TIME=$(( $(date +%s)*1000000000 ))
23+
else
24+
TRAVIS_END_TIME=$(date +%s%N)
25+
fi
1826
TIME_ELAPSED_SECONDS=$(( ($TRAVIS_END_TIME - $TRAVIS_START_TIME)/1000000000 ))
1927
echo -e "travis_time:end:$TRAVIS_TIME_ID:start=$TRAVIS_START_TIME,finish=$TRAVIS_END_TIME,duration=$(($TRAVIS_END_TIME - $TRAVIS_START_TIME))\n\e[0K"
2028
echo -e "travis_fold:end:$TRAVIS_FOLD_NAME"

0 commit comments

Comments
 (0)