• Yorick Peterse's avatar
    Reorganise and test std::time · 7f0cb46b
    Yorick Peterse authored
    std::time is now broken up into two modules:
    
    1. std::time, which provides time related types.
    2. std::time::duration, which provides the Duration type.
    
    This separation allows for the use of module methods to construct a
    Duration using different time units, instead of using methods defined on
    Duration itself. This means that instead of this:
    
        import std::time::Duration
    
        Duration.from_seconds(5)
    
    You now write this:
    
        import std::time::duration
    
        duration.from_seconds(5)
    
    == Renaming MonotonicTime to Instant
    
    MonotonicTime has been renamed to "Instant", which is a bit shorter and
    much easier to type. A new method has been added as well: "elapsed".
    This method can be used to measure the time that has elapsed since the
    Instant was created.
    
    == Adding and subtracting SystemTime and Instant
    
    The methods + and - for SystemTime and Instant no longer accept a
    ToFloat, instead they require a Duration. Accepting a ToFloat would
    allow you to add a SystemTime to another SystemTime, or add an Instant
    to an Instant. Neither make sense, so instead we now require the use of
    a Duration. This means that instead of this:
    
        import std::time
    
        time.now + 5
    
    You now have to write this:
    
        import std::time
        import std::time::duration
    
        time.now + duration.from_seconds(5)
    
    == Tests
    
    Finally, both std::time and std::time::duration have tests. These tests
    uncovered a few bugs in the implementation of SystemTime, which have
    been resolved.
    7f0cb46b
Name
Last commit
Last update
..
fs Loading commit data...
time Loading commit data...
test_ansi.inko Loading commit data...
test_array.inko Loading commit data...
test_array_iter.inko Loading commit data...
test_block.inko Loading commit data...
test_boolean.inko Loading commit data...
test_byte_array.inko Loading commit data...
test_env.inko Loading commit data...
test_error.inko Loading commit data...
test_ffi.inko Loading commit data...
test_float.inko Loading commit data...
test_format.inko Loading commit data...
test_fs.inko Loading commit data...
test_hash_map.inko Loading commit data...
test_inspect.inko Loading commit data...
test_integer.inko Loading commit data...
test_io.inko Loading commit data...
test_iterator.inko Loading commit data...
test_mirror.inko Loading commit data...
test_nil.inko Loading commit data...
test_object.inko Loading commit data...
test_os.inko Loading commit data...
test_process.inko Loading commit data...
test_range.inko Loading commit data...
test_string.inko Loading commit data...
test_string_buffer.inko Loading commit data...
test_time.inko Loading commit data...
test_trait.inko Loading commit data...