PyANGKernel.GKTimeDuration

class GKTimeDuration

Synopsis

Methods

Static functions

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

In Aimsun events start at a given moment and have a duration instead of an end time.

PyANGKernel.GKTimeDuration.MSECS_PER_DAY
__init__()
__init__(rhs)
Parameters:

rhsGKTimeDuration

__init__(t)
Parameters:

tQTime

__init__(dsinit)
Parameters:

dsinit – int

__init__(ms)
Parameters:

msstd::chrono::milliseconds

__init__(h, m[, s=0[, ms=0]])
Parameters:
  • h – int

  • m – int

  • s – int

  • ms – int

addMSecs(ms)
Parameters:

ms – int

Return type:

GKTimeDuration

Adds milliseconds to the current time duration

addSecs(secs)
Parameters:

secs – int

Return type:

GKTimeDuration

Adds seconds to the current time duration

static durationBetweenTimes(from, to)
Parameters:
Return type:

GKTimeDuration

Duration between to times. Note that a duration is always positive so this function will reorder from and to if to < from.

static durationBetweenTimes(from, to)
Parameters:
Return type:

GKTimeDuration

Duration between to times. Note that a duration is always positive so this function will reorder from and to if to < from.

static fromString(s)
Parameters:

s – str

Return type:

GKTimeDuration

Returns a duration from a string in the format HH:MM:SS

hour()
Return type:

int

Converts this duration to hour, minutes, seconds and milliseconds and returns the hour. For example: 3610.5 is converted to 01:00:10.500 and it returns 1.

isNull()
Return type:

bool

A duration of 0 milliseconds.

isValid()
Return type:

bool

Is valid?

static isValid(h, m, s)
Parameters:
  • h – int

  • m – int

  • s – int

Return type:

bool

Is valid?

minute()
Return type:

int

Converts this duration to hour, minutes, seconds and milliseconds and returns the minute. For example: 3610.5 is converted to 01:00:10.500 and it returns 0.

msec()
Return type:

int

Converts this duration to hour, minutes, seconds and milliseconds and returns the millisecond. For example: 3610.5 is converted to 01:00:10.500 and it returns 500.

msecsTo(t)
Parameters:

tGKTimeDuration

Return type:

int

Returns the number of remaining milliseconds until the desired time)

__ne__(d)
Parameters:

dGKTimeDuration

Return type:

bool

Returns true if the compared time durations are not equal

__add__(c)
Parameters:

cGKTimeDuration

Return type:

GKTimeDuration

Adds two time durations

__iadd__(c)
Parameters:

cGKTimeDuration

Return type:

GKTimeDuration

Adds a time duration to the current time duration

__sub__(c)
Parameters:

cGKTimeDuration

Return type:

GKTimeDuration

Subtracts a time duration to another time duration

__isub__(c)
Parameters:

cGKTimeDuration

Return type:

GKTimeDuration

Subtracts a time duration to the current time duration

__lt__(d)
Parameters:

dGKTimeDuration

Return type:

bool

Returns true if the left time duration is lower

__le__(d)
Parameters:

dGKTimeDuration

Return type:

bool

Returns true if the left time duration is lower or equal

__eq__(d)
Parameters:

dGKTimeDuration

Return type:

bool

Returns true if the compared time durations are equal

__gt__(d)
Parameters:

dGKTimeDuration

Return type:

bool

Returns true if the left time duration is greater

__ge__(d)
Parameters:

dGKTimeDuration

Return type:

bool

Returns true if the left time duration is greater or equal

second()
Return type:

int

Converts this duration to hour, minutes, seconds and milliseconds and returns the second. For example: 3610.5 is converted to 01:00:10.500 and it returns 10.

secsTo(arg__1)
Parameters:

arg__1GKTimeDuration

Return type:

int

Returns the number of remaining seconds until the desired time)

setHMS(h, m, s[, ms=0])
Parameters:
  • h – int

  • m – int

  • s – int

  • ms – int

Return type:

bool

Set the duration.

toDays([miliseconds=None])
Parameters:

milisecondsuint

Return type:

int

Returns this duration in days, the remaining time is returned in the miliseconds parameter if given.

toHours()
Return type:

float

Returns this GKTimeDuration ‘s hour, minute and second converted to hours

toMilliseconds()
Return type:

int

Get this duration in milliseconds (note that this is not equal to msec )

toMinutes()
Return type:

float

Returns this GKTimeDuration ‘s hour, minute and second converted to minutes

toQTime()
Return type:

QTime

Retuns a QTime equivalent to this duration. Note that an overflow is possible as QTime only support 24 hours (check QTime::isValid()).

toSeconds([miliseconds=None])
Parameters:

milisecondsuint

Return type:

int

Returns this GKTimeDuration ‘s hour, minute and second converted to seconds. If the miliseconds parameter is given, it will updated with the remaining miliseconds.

toString([forceMilliseconds=false])
Parameters:

forceMilliseconds – bool

Return type:

str

Returns a string representation of this duration. If forceMilliseconds is false it will not add millisecond info when they are zero.