View on GitHub

DSFML

dsfml.system.time

A module containing the Time struct

struct Time;
Represents a time value

The Time struct encapsulates a time value in a flexible way.

It allows to define a time value either as a number of seconds, milliseconds or microseconds. It also works the other way round: you can read a time value as either a number of seconds, milliseconds or microseconds.

By using such a flexible interface, the API doesn't impose any fixed type or resolution for time values, and let the user choose its own favorite representation.

Time values support the usual mathematical operations: you can add or subtract two times, multiply or divide a time by a number, compare two times, etc.

Since they represent a time span and not an absolute time value, times can also be negative.

const float asSeconds();
Return the time value as a number of seconds.

Returns:
Time in seconds.

const int asMilliseconds();
Return the time value as a number of milliseconds.

Returns:
Time in milliseconds.

const long asMicroseconds();
Return the time value as a number of microseconds.

Returns:
Time in microseconds.

static immutable immutable(Time) Zero;
Predefined "zero" time value.

Time seconds(float amount);
Construct a time value from a number of seconds.

Params:
float amount Number of seconds.





Returns : Time value constructed from the amount of microseconds.

Time milliseconds(int amount);
Construct a time value from a number of milliseconds.

Params:
int amount Number of milliseconds.

Returns:
Time value constructed from the amount of microseconds.

Time microseconds(long amount);
Construct a time value from a number of microseconds.

Params:
long amount Number of microseconds.





Returns : Time value constructed from the amount of microseconds.