using % when working with Double

I have noticed that the % operator does only work on int and that pose a litte problem for me.
I have a double containing a large number of milliseconds. and i would like to break it down into three INT variables (minutes,seconds,ms)
i have taken out the part that is bothering me right now. the ms=totaltime%1000; tosses an error, as you cant use % on a double. is there some way to do this? do anyone has another easy solution to this problem?

  double  totaltime=9234843; //the time in milliseconds
  int minutes;
  int seconds;
  int ms;

Thank you for your time!

Why not use unsigned long instead of double? That is what all the time functions like millis use.

Sorry to bother you, i found out a way to solve my problem
I did it the other way around instead, and that seems to work fine.
You could easily add hours to this equation too if necessary.
maybe someone else will have use of this solution.. when using millis() to count how long time that has elapsed, you often end up with alot of millis that you would like to show in a more suitable fashion.


SurferTim: can you use % on an unsigned long? i thought it only worked on INT ?

unsigned long should be a better choice in any way ofcourse!

It should work with the unsigned long. It certainly will not work with the float or double types. I can't check right now because my test Arduino is running a wifi server test sketch.

% calculates the remainder when one integer is divided by another.
An int is not the only type of integer type. A long, signed or unsigned, is an integer too, so % will work with it.

For float there exists the fmod() in C++ - fmod - C++ Reference -

void setup() 
  Serial.println("Start ");

  float E = exp(1);  // E = ~2.718281828

  Serial.println(fmod (5.3, 2) );     //  1.30
  Serial.println(fmod (18.5, 4.2) );  //  1.70
  Serial.println(fmod (118.5, 4.2) ); //  0.90
  Serial.println(fmod (10*PI, E) );   //  1.51

void loop()