# struct Time::Span

## Overview

`Time::Span` represents one period of time.

A `Time::Span` initializes with the specified period. Different numbers of arguments generates a `Time::Span` in different length. Check all `#new` methods for details.

``````Time::Span.new(10000)          # => 00:00:00.001
Time::Span.new(10, 10, 10)     # => 10:10:10
Time::Span.new(10, 10, 10, 10) # => 10.10:10:10``````

Calculation between `Time` also returns a `Time::Span`.

``````span = Time.new(2015, 10, 10) - Time.new(2015, 9, 10)
span       # => 30.00:00:00
span.class # => Time::Span``````

Inspection:

``````span = Time::Span.new(20, 10, 10)
span.hours   # => 20
span.minutes # => 10
span.seconds # => 10``````

Calculation:

``````a = Time::Span.new(20, 10, 10)
b = Time::Span.new(10, 10, 10)
c = a - b # => 10:00:00
c.hours   # => 10``````

time/span.cr

## Constant Summary

MaxValue = `new(Int64::MAX)`
MinValue = `new(Int64::MIN)`
TicksPerDay = `TicksPerHour * 24`
TicksPerHour = `TicksPerMinute * 60`
TicksPerMillisecond = `10000_i64`
TicksPerMinute = `TicksPerSecond * 60`
TicksPerSecond = `TicksPerMillisecond * 1000`
Zero = `new(0)`

## Instance Method Summary

, , , , ,

, , , ,

,

### Instance methods inherited from class `Object`

, , , , , , , , , , , , , , , , , , ,

,

## Constructor Detail

def self.from(value, tick_multiplicator) : self #

def self.new(days, hours, minutes, seconds, milliseconds) #

def self.new(days, hours, minutes, seconds) #

def self.new(hours, minutes, seconds) #

def self.new(ticks) #

def self.zero #

## Instance Method Detail

def *(number : Number) #

def +(other : self) #

def + #

def -(other : self) #

def - #

def /(number : Number) #

def /(other : self) #

def <=>(other : self) #

def abs #

def ago #

def days #

def duration #

def from_now #

def hours #

def inspect(io : IO) #

def milliseconds #

def minutes #

def seconds #

def ticks : Int64 #

def to_f #

def to_i #

def total_days #

def total_hours #

def total_milliseconds #

def total_minutes #

def total_seconds #

def total_weeks #

def zero? #