c++ time values

Hi,

I consider myself to be a beginner in c++, and really only know the basics, however I am looking for some help to with something quite complex.

I understand srand uses the time of a computer to help generate random numbers. Can some one please tell me how the computer see this?

Does 25/05/08 17:15pm 20 secs 10 milliseconds

look like this 25050817152010?

I would like to do this, because for one of my rand functions I wish to enter my own time variable, rather than the current computer time, does anyone know how I would do this.

Secondly in the above example i menioned millisecond, does srand take milliseoncds into account, or does it just do it on seconds?

Any help would be much appreciated.

thank you

hassan
srand() takes an integer as parameter to use as the initial seed. Typically people suggest using the current system time as returned by time() as the initial seed, but nothing mandates this.

If you choose to use the system time via time(), then understand that time() returns seconds elapsed since Jan. 1st, 1970.

You don't have to use time(); you could simply have the user enter a number or any other means you wish.

Hi, thank you for your, I do wish to use srand, however not the system time of my machine, i.e. I am in the UK, therefore system time is GMT, but I want the program to use Paris time for example.

Would anyone know how best to go aobut doing this? or using any other time value for that?

Possibly: srand(time(NULL)+200)? If this is totally wrong forgive i am a newbie :P
You just have to add or subtract the number of seconds difference between UTC and Paris time. But why do you care in the first place?
Topic archived. No new replies allowed.