Hi all, is there a way to have the system time using DirectX and C++ to use it in a clock?
I'm searching for some example.
Thank you in advanced!
Printable View
Hi all, is there a way to have the system time using DirectX and C++ to use it in a clock?
I'm searching for some example.
Thank you in advanced!
Your using DirectX, therefor your using windows. There are plenty functions there. I'm lazy so search the web for <time.h>
To clarify the problem!!
I'm trying to do a clock using the DirectX & C++.
So I wrote quite everything but now I have a BIG problem, I have to use the system time and apply the hour to the hour hand on the clock and the same for the minute hand.
I have created a function called SetValue(int valueH, int valueM) that calculates and sets the position on the clock of the hands, but I don't know how can I get the system time.
Here my control (part of a code):
By now the hands rotate, but not using the system time!Code:static int minute = 0;
static int hour = 1;
minute++;
if (minute > 59)
{
if (hour > 11)
hour = 0;
hour++;
minute = 0;
}
for (i = 0; i < Clock; i++)
ClockV.getElement(i)->SetValue(hour, minute);
Please help me!! :( :(
Code:time_t t = time(0);
int secs = localtime (&t) -> tm_sec;
int mins = localtime (&t) -> tm_min;
int hours = localtime (&t) -> tm_hour;
int dayofmonth = localtime (&t) -> tm_mday;
int month = localtime (&t) -> tm_mon;
int year = localtime (&t) -> tm_year;
Thank you, finally I've fixed my problem.
Really thank you!