OpenShot Library | OpenShotAudio
0.2.1
|
A relative measure of time. More...
#include <juce_RelativeTime.h>
Public Member Functions | |
RelativeTime (double seconds=0.0) noexcept | |
Creates a RelativeTime. More... | |
RelativeTime (const RelativeTime &other) noexcept | |
Copies another relative time. More... | |
RelativeTime & | operator= (const RelativeTime &other) noexcept |
Copies another relative time. More... | |
~RelativeTime () noexcept | |
Destructor. More... | |
int64 | inMilliseconds () const noexcept |
Returns the number of milliseconds this time represents. More... | |
double | inSeconds () const noexcept |
Returns the number of seconds this time represents. More... | |
double | inMinutes () const noexcept |
Returns the number of minutes this time represents. More... | |
double | inHours () const noexcept |
Returns the number of hours this time represents. More... | |
double | inDays () const noexcept |
Returns the number of days this time represents. More... | |
double | inWeeks () const noexcept |
Returns the number of weeks this time represents. More... | |
String | getDescription (const String &returnValueForZeroTime="0") const |
Returns a readable textual description of the time. More... | |
String | getApproximateDescription () const |
This returns a string that roughly describes how long ago this time was, which can be handy for showing ages of files, etc. More... | |
RelativeTime | operator+= (RelativeTime timeToAdd) noexcept |
Adds another RelativeTime to this one. More... | |
RelativeTime | operator-= (RelativeTime timeToSubtract) noexcept |
Subtracts another RelativeTime from this one. More... | |
RelativeTime | operator+= (double secondsToAdd) noexcept |
Adds a number of seconds to this time. More... | |
RelativeTime | operator-= (double secondsToSubtract) noexcept |
Subtracts a number of seconds from this time. More... | |
Static Public Member Functions | |
static RelativeTime | milliseconds (int milliseconds) noexcept |
Creates a new RelativeTime object representing a number of milliseconds. More... | |
static RelativeTime | milliseconds (int64 milliseconds) noexcept |
Creates a new RelativeTime object representing a number of milliseconds. More... | |
static RelativeTime | seconds (double seconds) noexcept |
Creates a new RelativeTime object representing a number of seconds. More... | |
static RelativeTime | minutes (double numberOfMinutes) noexcept |
Creates a new RelativeTime object representing a number of minutes. More... | |
static RelativeTime | hours (double numberOfHours) noexcept |
Creates a new RelativeTime object representing a number of hours. More... | |
static RelativeTime | days (double numberOfDays) noexcept |
Creates a new RelativeTime object representing a number of days. More... | |
static RelativeTime | weeks (double numberOfWeeks) noexcept |
Creates a new RelativeTime object representing a number of weeks. More... | |
A relative measure of time.
The time is stored as a number of seconds, at double-precision floating point accuracy, and may be positive or negative.
If you need an absolute time, (i.e. a date + time), see the Time class.
Definition at line 40 of file juce_RelativeTime.h.
|
explicitnoexcept |
Creates a RelativeTime.
seconds | the number of seconds, which may be +ve or -ve. |
Definition at line 26 of file juce_RelativeTime.cpp.
Referenced by days(), getDescription(), hours(), milliseconds(), minutes(), seconds(), and weeks().
|
noexcept |
Copies another relative time.
Definition at line 27 of file juce_RelativeTime.cpp.
|
noexcept |
Destructor.
Definition at line 28 of file juce_RelativeTime.cpp.
|
noexcept |
Copies another relative time.
Definition at line 47 of file juce_RelativeTime.cpp.
|
staticnoexcept |
Creates a new RelativeTime object representing a number of milliseconds.
Definition at line 31 of file juce_RelativeTime.cpp.
References RelativeTime().
Referenced by juce::TimeSliceThread::addTimeSliceClient(), juce::TimeSliceThread::getClient(), milliseconds(), and juce::Time::operator-=().
|
staticnoexcept |
Creates a new RelativeTime object representing a number of milliseconds.
Definition at line 32 of file juce_RelativeTime.cpp.
References milliseconds(), and RelativeTime().
|
staticnoexcept |
Creates a new RelativeTime object representing a number of seconds.
Definition at line 33 of file juce_RelativeTime.cpp.
References RelativeTime().
Referenced by juce::NetworkServiceDiscovery::AvailableServiceList::getServices().
|
staticnoexcept |
Creates a new RelativeTime object representing a number of minutes.
Definition at line 34 of file juce_RelativeTime.cpp.
References RelativeTime().
Referenced by getApproximateDescription().
|
staticnoexcept |
Creates a new RelativeTime object representing a number of hours.
Definition at line 35 of file juce_RelativeTime.cpp.
References RelativeTime().
Referenced by getApproximateDescription().
|
staticnoexcept |
Creates a new RelativeTime object representing a number of days.
Definition at line 36 of file juce_RelativeTime.cpp.
References RelativeTime().
Referenced by getApproximateDescription(), and juce::Time::getCompilationDate().
|
staticnoexcept |
Creates a new RelativeTime object representing a number of weeks.
Definition at line 37 of file juce_RelativeTime.cpp.
References RelativeTime().
Referenced by getApproximateDescription().
|
noexcept |
Returns the number of milliseconds this time represents.
Definition at line 40 of file juce_RelativeTime.cpp.
Referenced by getDescription(), and juce::NetworkServiceDiscovery::Advertiser::~Advertiser().
|
inlinenoexcept |
Returns the number of seconds this time represents.
Definition at line 105 of file juce_RelativeTime.h.
References JUCE_API.
Referenced by getDescription(), and operator-=().
|
noexcept |
Returns the number of minutes this time represents.
Definition at line 41 of file juce_RelativeTime.cpp.
Referenced by getApproximateDescription(), and getDescription().
|
noexcept |
Returns the number of hours this time represents.
Definition at line 42 of file juce_RelativeTime.cpp.
Referenced by getApproximateDescription(), and getDescription().
|
noexcept |
Returns the number of days this time represents.
Definition at line 43 of file juce_RelativeTime.cpp.
Referenced by getDescription().
|
noexcept |
Returns the number of weeks this time represents.
Definition at line 44 of file juce_RelativeTime.cpp.
Referenced by getApproximateDescription(), and getDescription().
Returns a readable textual description of the time.
The exact format of the string returned will depend on the magnitude of the time - e.g.
"1 min 4 secs", "1 hr 45 mins", "2 weeks 5 days", "140 ms"
so that only the two most significant units are printed.
The returnValueForZeroTime value is the result that is returned if the length is zero. Depending on your application you might want to use this to return something more relevant like "empty" or "0 secs", etc.
Definition at line 107 of file juce_RelativeTime.cpp.
References juce::StringArray::add(), inDays(), inHours(), inMilliseconds(), inMinutes(), inSeconds(), inWeeks(), juce::StringArray::isEmpty(), juce::StringArray::joinIntoString(), RelativeTime(), and juce::StringArray::size().
String juce::RelativeTime::getApproximateDescription | ( | ) | const |
This returns a string that roughly describes how long ago this time was, which can be handy for showing ages of files, etc.
This will only attempt to be accurate to within the nearest order of magnitude so returns strings such as "5 years", "2 weeks", "< 1 minute", "< 1 sec" etc.
Definition at line 78 of file juce_RelativeTime.cpp.
References days(), hours(), inHours(), inMinutes(), inWeeks(), minutes(), and weeks().
|
noexcept |
Adds another RelativeTime to this one.
Definition at line 49 of file juce_RelativeTime.cpp.
|
noexcept |
Subtracts another RelativeTime from this one.
Definition at line 50 of file juce_RelativeTime.cpp.
|
noexcept |
Adds a number of seconds to this time.
Definition at line 51 of file juce_RelativeTime.cpp.
|
noexcept |
Subtracts a number of seconds from this time.
Definition at line 52 of file juce_RelativeTime.cpp.
References inSeconds(), and JUCE_API.