Skip to content

Commit

Permalink
Update TestSchedulerVirtualTimeConverter.swift (ReactiveX#2482)
Browse files Browse the repository at this point in the history
* Update TestSchedulerVirtualTimeConverter.swift

Updated Description to correct conversion

* Updated Documentation 'interval'

* NSTimeInterval -> TimeInterval

---------

Co-authored-by: Shai Mishali <[email protected]>
  • Loading branch information
allensoberano and freak4pc authored May 11, 2023
1 parent ce3e534 commit d6b70c0
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion RxSwift/Schedulers/HistoricalScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

/// Provides a virtual time scheduler that uses `Date` for absolute time and `NSTimeInterval` for relative time.
/// Provides a virtual time scheduler that uses `Date` for absolute time and `TimeInterval` for relative time.
public class HistoricalScheduler : VirtualTimeScheduler<HistoricalSchedulerTimeConverter> {

/**
Expand Down
10 changes: 5 additions & 5 deletions RxSwift/Schedulers/VirtualTimeConverterType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public protocol VirtualTimeConverterType {
func convertToVirtualTime(_ time: RxTime) -> VirtualTimeUnit

/**
Converts from virtual time interval to `NSTimeInterval`.
Converts from virtual time interval to `TimeInterval`.
- parameter virtualTimeInterval: Virtual time interval to convert to `NSTimeInterval`.
- returns: `NSTimeInterval` corresponding to virtual time interval.
- parameter virtualTimeInterval: Virtual time interval to convert to `TimeInterval`.
- returns: `TimeInterval` corresponding to virtual time interval.
*/
func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> TimeInterval

/**
Converts from `NSTimeInterval` to virtual time interval.
Converts from `TimeInterval` to virtual time interval.
- parameter timeInterval: `NSTimeInterval` to convert to virtual time interval.
- parameter timeInterval: `TimeInterval` to convert to virtual time interval.
- returns: Virtual time interval corresponding to time interval.
*/
func convertToVirtualTimeInterval(_ timeInterval: TimeInterval) -> VirtualTimeIntervalUnit
Expand Down
2 changes: 1 addition & 1 deletion RxTest/Schedulers/TestScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class TestScheduler : VirtualTimeScheduler<TestSchedulerVirtualTimeConver
Creates a new test scheduler.
- parameter initialClock: Initial value for the clock.
- parameter resolution: Real time [NSTimeInterval] = ticks * resolution
- parameter resolution: Real time [TimeInterval] = ticks * resolution
- parameter simulateProcessingDelay: When true, if something is scheduled right `now`,
it will be scheduled to `now + 1` in virtual time.
*/
Expand Down
12 changes: 6 additions & 6 deletions RxTest/Schedulers/TestSchedulerVirtualTimeConverter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
import RxSwift

/// Converter from virtual time and time interval measured in `Int`s to `Date` and `NSTimeInterval`.
/// Converter from virtual time and time interval measured in `Int`s to `Date` and `TimeInterval`.
public struct TestSchedulerVirtualTimeConverter : VirtualTimeConverterType {
/// Virtual time unit used that represents ticks of virtual clock.
public typealias VirtualTimeUnit = Int
Expand Down Expand Up @@ -40,17 +40,17 @@ public struct TestSchedulerVirtualTimeConverter : VirtualTimeConverterType {
VirtualTimeIntervalUnit(time.timeIntervalSince1970 / self.resolution + 0.5)
}

/// Converts from virtual time interval to `NSTimeInterval`.
/// Converts from virtual time interval to `TimeInterval`.
///
/// - parameter virtualTimeInterval: Virtual time interval to convert to `NSTimeInterval`.
/// - returns: `NSTimeInterval` corresponding to virtual time interval.
/// - parameter virtualTimeInterval: Virtual time interval to convert to `TimeInterval`.
/// - returns: `TimeInterval` corresponding to virtual time interval.
public func convertFromVirtualTimeInterval(_ virtualTimeInterval: VirtualTimeIntervalUnit) -> TimeInterval {
TimeInterval(virtualTimeInterval) * self.resolution
}

/// Converts from virtual time interval to `NSTimeInterval`.
/// Converts from `TimeInterval` to virtual time interval.
///
/// - parameter timeInterval: `NSTimeInterval` to convert to virtual time interval.
/// - parameter timeInterval: `TimeInterval` to convert to virtual time interval.
/// - returns: Virtual time interval corresponding to time interval.
public func convertToVirtualTimeInterval(_ timeInterval: TimeInterval) -> VirtualTimeIntervalUnit {
VirtualTimeIntervalUnit(timeInterval / self.resolution + 0.5)
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/HistoricalScheduler.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ <h1>HistoricalScheduler</h1>

</div>
</div>
<p>Provides a virtual time scheduler that uses <code>Date</code> for absolute time and <code>NSTimeInterval</code> for relative time.</p>
<p>Provides a virtual time scheduler that uses <code>Date</code> for absolute time and <code>TimeInterval</code> for relative time.</p>

</div>
</section>
Expand Down
10 changes: 5 additions & 5 deletions docs/Protocols/VirtualTimeConverterType.html
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ <h4>Return Value</h4>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Converts from virtual time interval to <code>NSTimeInterval</code>.</p>
<p>Converts from virtual time interval to <code>TimeInterval</code>.</p>

</div>
<div class="declaration">
Expand All @@ -547,7 +547,7 @@ <h4>Parameters</h4>
</td>
<td>
<div>
<p>Virtual time interval to convert to <code>NSTimeInterval</code>.</p>
<p>Virtual time interval to convert to <code>TimeInterval</code>.</p>
</div>
</td>
</tr>
Expand All @@ -556,7 +556,7 @@ <h4>Parameters</h4>
</div>
<div>
<h4>Return Value</h4>
<p><code>NSTimeInterval</code> corresponding to virtual time interval.</p>
<p><code>TimeInterval</code> corresponding to virtual time interval.</p>
</div>
</section>
</div>
Expand All @@ -574,7 +574,7 @@ <h4>Return Value</h4>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Converts from <code>NSTimeInterval</code> to virtual time interval.</p>
<p>Converts from <code>TimeInterval</code> to virtual time interval.</p>

</div>
<div class="declaration">
Expand All @@ -597,7 +597,7 @@ <h4>Parameters</h4>
</td>
<td>
<div>
<p><code>NSTimeInterval</code> to convert to virtual time interval.</p>
<p><code>TimeInterval</code> to convert to virtual time interval.</p>
</div>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/RxSwift/Schedulers.html
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ <h4>Declaration</h4>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Provides a virtual time scheduler that uses <code>Date</code> for absolute time and <code>NSTimeInterval</code> for relative time.</p>
<p>Provides a virtual time scheduler that uses <code>Date</code> for absolute time and <code>TimeInterval</code> for relative time.</p>

<a href="../Classes/HistoricalScheduler.html" class="slightly-smaller">See more</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

0 comments on commit d6b70c0

Please sign in to comment.