We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
After #16, some TimeSpans produce ranges of different lengths, even though they have the same duration:
using TimeSpans, Dates sample_rate = 250.0 span = TimeSpan(1032552000000, 1062552000000) offseted = TimeSpans.translate(span, -start(span)) # Current version i = index_from_time(sample_rate, start(span)) j = index_from_time(sample_rate, stop(span)) length(i:(j-1)) # 7501 !!!!!!! i = index_from_time(sample_rate, start(offseted)) j = index_from_time(sample_rate, stop(offseted)) length(i:(j-1)) # 7500 # old version (TimeSpans#0.2.3) function index_from_time_old(sample_rate, sample_time::Period) time_in_nanoseconds = convert(Nanosecond, sample_time).value time_in_nanoseconds >= 0 || throw(ArgumentError("`sample_time` must be >= 0 nanoseconds")) ns_per_sample = inv(sample_rate) * 1_000_000_000 return floor(Int, time_in_nanoseconds / ns_per_sample) + 1 end to_second(x) = x.value / 1e9 i = index_from_time_old(sample_rate, start(span)) j = index_from_time_old(sample_rate, stop(span)) length(i:(j-1)) # 7500 offset = start(span) i = index_from_time_old(sample_rate, start(offseted)) j = index_from_time_old(sample_rate, stop(offseted)) length(i:(j-1)) # 7500
The text was updated successfully, but these errors were encountered:
No branches or pull requests
After #16, some TimeSpans produce ranges of different lengths, even though they have the same duration:
The text was updated successfully, but these errors were encountered: