
 
Aktyw Forum
Zarejestruj się na forum.ep.com.pl i zgłoś swój akces do Aktywu Forum. Jeśli jesteś już zarejestrowany wystarczy, że się zalogujesz.
Sprawdź punkty Zarejestruj siętyp TDataTime albo podobny np TTimeStamp ????
Moderatorzy:Jacek Bogusz, Moderatorzy
mam prośbe czy ktoś może mi podać rozpiske jakiegoś formatu daty i czasu (oszczędnego w miejsce) ... wiem że robiło się to na float, ale nie pamiętam jak 
			
 Funcja time() zwraca liczbe secund jakie minely od polnocy 1.01.1970. Ujemna wartosc uzywa sie do przedstatwienia czasu z przed tej daty. Funkcja ta zwaraca long integer a to przyklad z ksiazki "Teach Yourself C in 21 Days" listing 19.2
 Funcja time() zwraca liczbe secund jakie minely od polnocy 1.01.1970. Ujemna wartosc uzywa sie do przedstatwienia czasu z przed tej daty. Funkcja ta zwaraca long integer a to przyklad z ksiazki "Teach Yourself C in 21 Days" listing 19.2
Kod: Zaznacz cały
/* Demonstrates the time functions. */
#include <stdio.h>
#include <time.h>
main()
{
      time_t start, finish, now;
      struct tm *ptr;
      char *c, buf1[80];
      double duration;
      /* Record the time the program starts execution. */
      start = time(0);
      /* Record the current time, using the alternate method of */
      /* calling time(). */
      time(&now);
      /* Convert the time_t value into a type tm structure. */
      ptr = localtime(&now);
      /* Create and display a formatted string containing */
      /* the current time. */
      c = asctime(ptr);
      puts(c);
      getc(stdin);
      /* Now use the strftime() function to create several different */
      /* formatted versions of the time. */
      strftime(buf1, 80, "This is week %U of the year %Y", ptr);
      puts(buf1);
      getc(stdin);
      strftime(buf1, 80, "Today is %A, %x", ptr);
      puts(buf1);
      getc(stdin);
      strftime(buf1, 80, "It is %M minutes past hour %I.", ptr);
      puts(buf1);
      getc(stdin);
      /* Now get the current time and calculate program duration. */
      finish = time(0);
      duration = difftime(finish, start);
      printf("\nProgram execution time using time() = %f seconds.",
             duration);
      puts 
      ("\nPress Enter to end program ");
      getchar(); // ACeK 
      
      return(0);
}
- 
				Jurek Szczesiul
- - 
- Posty:175
- Rejestracja:10 paź 2003, o 20:44
- Lokalizacja:Białystok
- Kontaktowanie:
Re: typ TDataTime albo podobny np TTimeStamp ????
Każdy robi po swojemu : np. TDateTime w ObjectPascalu ( Delphi ) to :mam prośbe czy ktoś może mi podać rozpiske jakiegoś formatu daty i czasu (oszczędnego w miejsce) ... wiem że robiło się to na float, ale nie pamiętam jak
Pozdrowienia Jurek S.[/code]TDateTime represents a date-and-time value in the Delphi language.
type TDateTime = type Double;
Description
Most CLX objects represent date and time values using a TDateTime value. In Delphi, TDateTime is a type that maps to a Double. In C++, the TDateTime class corresponds to the Delphi TDateTime type.
The integral part of a Delphi TDateTime value is the number of days that have passed since 12/30/1899. The fractional part of the TDateTime value is fraction of a 24 hour day that has elapsed.
Following are some examples of TDateTime values and their corresponding dates and times:
0 12/30/1899 12:00 am
2.75 1/1/1900 6:00 pm
-1.25 12/29/1899 6:00 am
35065 1/1/1996 12:00 am
Kto jest online
Użytkownicy przeglądający to forum: Obecnie na forum nie ma żadnego zarejestrowanego użytkownika i 19 gości



