Thread: Return the system time!

  1. #1
    Registered User
    Join Date
    Jul 2005

    Arrow Return the system time!

    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!

  2. #2
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Republika Srpska - Balkan
    Your using DirectX, therefor your using windows. There are plenty functions there. I'm lazy so search the web for <time.h>
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Join is in our Unofficial Cprog IRC channel
    Channel: #Tech

    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    Registered User
    Join Date
    Jul 2005
    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):
    	static int minute = 0;
    	static int hour = 1;
    	if (minute > 59)
    		if (hour > 11)
    			hour = 0;
    		minute = 0;
    	for (i = 0; i < Clock; i++)
    		ClockV.getElement(i)->SetValue(hour, minute);
    By now the hands rotate, but not using the system time!

    Please help me!!
    Last edited by Arkanos; 04-14-2006 at 07:38 AM.

  5. #5
    C / C++
    Join Date
    Jan 2006
    The Netherlands
    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;
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  6. #6
    Registered User
    Join Date
    Jul 2005
    Thank you, finally I've fixed my problem.
    Really thank you!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New string functions
    By Elysia in forum C Programming
    Replies: 11
    Last Post: 03-28-2009, 05:03 AM
  2. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  3. Another weird error
    By rwmarsh in forum Game Programming
    Replies: 4
    Last Post: 09-24-2006, 10:00 PM
  4. The new FAQ
    By Hammer in forum A Brief History of
    Replies: 34
    Last Post: 08-30-2006, 10:05 AM
  5. Algorithm to walk through a maze.
    By Nutshell in forum C Programming
    Replies: 30
    Last Post: 01-21-2002, 01:54 AM