5 Replies - 2316 Views - Last Post: 28 October 2009 - 12:07 PM Rate Topic: -----

#1 amin_bouma  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-October 09

calculate the seconds elapsed since certain date

Post icon  Posted 28 October 2009 - 07:03 AM

Bonjour,

Je dois calculer le nombre de secondes qui se sont écoulées depuis une certaine date au format JJ/MM/AAAA et HH/MIN/SEC

Je cherche une méthode propre et je pensais utiliser la librairie time.h mais je ne trouve rien qui puisse me correspondre.
Avant de passer à la méthode "bourrine" j'aimerais savoir si quelqu'un à une piste ...

merci

Amine
Is This A Good Question/Topic? 0
  • +

Replies To: calculate the seconds elapsed since certain date

#2 jeff666  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 193
  • Joined: 30-December 08

Re: calculate the seconds elapsed since certain date

Posted 28 October 2009 - 07:23 AM

This forum is english
For french forum, ask on C / windows programming ng http://minilien.com/?unIaO28zJP
(or others...)
Was This Post Helpful? 0
  • +
  • -

#3 brds  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 76
  • View blog
  • Posts: 515
  • Joined: 22-October 08

Re: calculate the seconds elapsed since certain date

Posted 28 October 2009 - 07:58 AM

I understod that?? :blink:

time_t a, b, c;
struct tm tmp;

tmp.tm_year = 2000;
tmp.tm_mon = 2;
tmp.tm_mday = 2;
tmp.tm_hour = 6;
tmp.tm_min = 36; 
tmp.tm_sec = 15; 

a = mktime(&tmp); /* So a = March 2nd, 2000 06:36:15 */

/* Load tmp with another date */

b = mktime(&tmp);

c = a - b; /* c = difference in seconds */


Was This Post Helpful? 0
  • +
  • -

#4 amin_bouma  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 26-October 09

Re: calculate the seconds elapsed since certain date

Posted 28 October 2009 - 08:09 AM

View Postbrds, on 28 Oct, 2009 - 06:58 AM, said:

I understod that?? :blink:

time_t a, b, c;
struct tm tmp;

tmp.tm_year = 2000;
tmp.tm_mon = 2;
tmp.tm_mday = 2;
tmp.tm_hour = 6;
tmp.tm_min = 36; 
tmp.tm_sec = 15; 

a = mktime(&tmp); /* So a = March 2nd, 2000 06:36:15 */

/* Load tmp with another date */

b = mktime(&tmp);

c = a - b; /* c = difference in seconds */




yes it's totally that ... thank you very much
best regards
A.
Was This Post Helpful? 0
  • +
  • -

#5 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,405
  • Joined: 15-July 09

Re: calculate the seconds elapsed since certain date

Posted 28 October 2009 - 11:42 AM

I bet he understood what he posted when his teacher told him the task.


Wooot?!?:o
Was This Post Helpful? 0
  • +
  • -

#6 brds  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 76
  • View blog
  • Posts: 515
  • Joined: 22-October 08

Re: calculate the seconds elapsed since certain date

Posted 28 October 2009 - 12:07 PM

Merde! :angry:

Damn sneaky frenchie!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1