"Tomas Deman" <to********@PLEASEDONTSPAMhotmail.com> wrote:
I have a problem converting a borland cpp (v4.52) time_t value to a visual
basic date.
What does borland exactly store?
Who knows? Ask Borland. This is not a C matter. All the C Standard says
is that time_t is an arithmetic type used for storing calendar time; it
doesn't say anything about _how_ it does this. A long double storing a
Julian Date is legal.
FWIW, since different systems and indeed different compilers for the
same system implement time_t differently, you should never store a
time_t in a file for other programs to use. Store a well-defined date
format instead; for example, the ISO yyyymmddhhmmss format. mktime() and
strftime() are ideal for this.
I heard this should be #seconds since
1/1/1970 0:00 in EST time. How can borland do this in dos without having set
the TZ environment variable?
It can't, so it is unlikely that that is what it stores. Seconds since
0/0/1980[1] 00:00 in whatever timezone is local to the computer clock is
more likely. Now work out how many bytes it uses, what endianness it
has, and how many spacing bits there are, and you're partly on the way
to figuring out the format.
As I said: asking the C program (or, for that matter, the VB program,
the Pascal program, or whatever program wants to communicate with
someone else) to store a decent format in the first place is probably
less hassle.
Richard
[1] No kidding: set an MS-DOS file date to all-bits-zero and do a DIR.