Skip to content

Commit

Permalink
Fixed the issue with raf.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
zaqbez39me committed Feb 29, 2024
1 parent 173ddc4 commit b68181c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metrics/raf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ base=$(basename "${java}")

# To check that file was added in commit any time
if git status > /dev/null 2>&1 && test -n "$(git log --oneline -- "${base}")"; then
file_creation=$(stat "$base" | awk '/Modify/{print $2, $3}')
file_creation=$(git log --pretty=format:"%ci" --date=default -- "${base}" | tail -n 1)
repo_creation=$(git log --reverse --format="format:%ci" | sed -n 1p)
current_time=$(date "+%Y-%m-%d %H:%M:%S %z")
file_creation_timestamp=$(date -d "$file_creation" +%s)
repo_creation_timestamp=$(date -d "$repo_creation" +%s)
current_time_timestamp=$(date -d "$current_time" +%s)
from_file_creation=$((current_time_timestamp - file_creation_timestamp))
from_repo_creation=$((current_time_timestamp - repo_creation_timestamp))
raf=$(echo 'import sys; print(int(sys.argv[1])//1000)' | python - $((from_file_creation)) $((from_repo_creation)))
raf=$(echo 'import sys; print(float(sys.argv[1])/float(sys.argv[2]) if float(sys.argv[2]) != 0 else 1.0)' | python - $((from_file_creation)) $((from_repo_creation)))
else
raf=0
fi
Expand Down

0 comments on commit b68181c

Please sign in to comment.