Get seconds from 1970

Hello, I have some problem.
I need to calculate how many seconds gone since 1970.
I used tm structure and mktime()function, but I have wrong results. Here is the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <vcl.h>
#include <time.h>

struct tm t;
time_t t1,t2;

void __fastcall TForm1::Button1Click(TObject *Sender)
{

    t.tm_year = 2008-1900;
    t.tm_mon = 3;
    t.tm_mday = 9;
    t.tm_hour = 16;
    t.tm_min = 39;
    t.tm_sec = 42;
    t.tm_isdst = 0;
    t1=mktime(&t);

    Memo1->Lines->Add(IntToStr(t1));
    Memo1->Lines->Add(ctime(&t1));
}

I`ve got 1207748382 instead of 3416917182.
What I`am doing wrong?
Thx for the help )
Last edited on
Topic archived. No new replies allowed.