1 /***************************************************************************
4 begin : Sat Sep 14 2002
5 copyright : (C) 2002 by Jason Wood
6 email : jasonwood@blueyonder.co.uk
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
20 double GenTime::s_delta = 0.00001;
22 /** Creates a time object, with a time of 0 seconds. */
27 /** Creates a time object, with time given in seconds. */
28 GenTime::GenTime(double seconds) {
32 /** Creates a time object, by passing number of frames and how many frames per second */
33 GenTime::GenTime(int frames, double framesPerSecond) {
34 m_time = (double) frames / framesPerSecond;
37 /** Returns the time, in milliseconds */
38 double GenTime::ms() const {
42 /** Returns the time in frames, after being given the number of frames per second */
43 double GenTime::frames(double framesPerSecond) const {
44 return (int) floor(m_time * framesPerSecond + 0.5);