Skip to content

Fix clock::now() Can't locate Time/HiRes.pm #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

nawawi
Copy link
Contributor

@nawawi nawawi commented Sep 3, 2024

📚 Description

Fix: #318

bashunit will throw an error when Perl Time::Hires is not available. This requires a minor fix to the clock::now() function.

🔖 Changes

function clock::now() {
  if perl -MTime::HiRes -e "" > /dev/null 2>&1; then
    perl -MTime::HiRes -e 'printf("%.0f\n",Time::HiRes::time()*1000)'
  elif [[ "$_OS" != "OSX" ]]; then
    date +%s%N
  else
    echo ""
  fi
}

✅ To-do list

  • I updated the CHANGELOG.md to reflect the new feature or fix
  • I updated the documentation to reflect the changes

@rene-hermenau
Copy link

Nice! Thanks for the fix @nawawi Works for me!

Copy link
Member

@Chemaclass Chemaclass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

many thanks!!

@Chemaclass Chemaclass added the bug Something isn't working label Sep 3, 2024
@Chemaclass Chemaclass merged commit 67a452a into TypedDevs:main Sep 3, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't locate Time/HiRes.pm
6 participants