1. read/write file timestamp

How does one read the epoch time for a file in Eu on windoze, and then 
apply that timestamp to another file? I know dir() lists the time and date, but 
that's not epoch time, and it doesn't write a new timestamp or other 
attributes to a file. Win32lib has a attribute set for hidden, system, 
compressed, etc, but not time/date ?

Kat

new topic     » topic index » view message » categorize

2. read/write file timestamp

How does one read the epoch time for a file in Eu on windoze, and then 
apply that timestamp to another file? I know dir() lists the time and date, but
that's not epoch time, and it doesn't write a new timestamp or other attributes
to a file. Win32lib has a attribute set for hidden, system, compressed, etc, 
but
not time/date ?

Kat

new topic     » goto parent     » topic index » view message » categorize

3. Re: read/write file timestamp

Kat wrote:

> How does one read the epoch time for a file in Eu on windoze, and then
> apply that timestamp to another file? I know dir() lists the time and date,
> but
> that's not epoch time, and it doesn't write a new timestamp or other
> attributes
> to a file. Win32lib has a attribute set for hidden, system, compressed, etc,
> but not time/date ?

Use the Windows API functions GetFileTime and SetFileTime in kernel32.dll
to read and write file timestamps.
I think you must convert the "Windows time" from/to epoch time yourself,
here is some information (there seem to be different "epoch times"):
   http://www.clueless.com/jargon3.0.0/epoch.html
   http://en.wikipedia.org/wiki/Unix_epoch

Regards,
   Juergen

new topic     » goto parent     » topic index » view message » categorize

4. Re: read/write file timestamp

You can use datetime.e
--  DateTime.e - Routines for handling Date and Time - (c) 2001 CyrekSoft  --


Use secondsDifference() function, like this:

d = dir(...)
epoch = secondsDifference({{1970,1,1},{0,0,0}},{
{d[1][D_YEAR],d[1][D_MONTH],d[1][D_DAY]},
{d[1][D_HOUR],d[1][D_MINUTE],d[1][D_SECOND]}})



K> How does one read the epoch time for a file in Eu on windoze, and then
K> apply that timestamp to another file? I know dir() lists the time and date,
but
K> that's not epoch time, and it doesn't write a new timestamp or other
attributes
K> to a file. Win32lib has a attribute set for hidden, system, compressed, etc,
K> but
K> not time/date ?

K> Kat

new topic     » goto parent     » topic index » view message » categorize

5. Re: read/write file timestamp

----- Original Message ----- 
From: "Kat" <gertie at visionsix.com>
To: <EUforum at topica.com>
Subject: read/write file timestamp


> 
> 
> How does one read the epoch time for a file in Eu on windoze, and then 
> apply that timestamp to another file? I know dir() lists the time and date,
> but
> that's not epoch time, and it doesn't write a new timestamp or other
> attributes
> to a file. Win32lib has a attribute set for hidden, system, compressed, etc, 
> but
> not time/date ?
> 

Kat,
I don't think Windows has a concept of epoch time. The files times are stored as
a 64-bit value representing the number of 100-nanosecond intervals since January
1, 1601.

And there is no API to change the datetimes (that I know of).

-- 
Derek

new topic     » goto parent     » topic index » view message » categorize

6. Re: read/write file timestamp

Derek wrote:

> ----- Original Message ----- 
> From: "Kat"
>
>>
>> How does one read the epoch time for a file in Eu on windoze, and then
>> apply that timestamp to another file? I know dir() lists the time and date,
>> but
>> that's not epoch time, and it doesn't write a new timestamp or other
>> attributes
>> to a file. Win32lib has a attribute set for hidden, system, compressed, etc,
>> but not time/date ?
>>
>
> Kat,
> I don't think Windows has a concept of epoch time. The files times are
> stored as a 64-bit value representing the number of 100-nanosecond
> intervals since January 1, 1601.
>
> And there is no API to change the datetimes (that I know of).

There actually is. I just remembered, that I already had published it.
smile Sorry Kat, I didn't think of it, when I replied the first time.
(Things like this sometimes happen, when one gets older...)

Go to http://home.arcor.de/luethje/prog/ and get the file 'mbox100.zip'.
It comes with the Euphoria source code. Look at 'winfile.e'.

Regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |    |\      _,,,---,,_
 \ /  against HTML in       |    /,`.-'`'    -.  ;-;;,_
  X   e-mail and news,      |   |,4-  ) )-,_..;\ (  `'-'
 / \  and unneeded MIME     |  '---''(_/--'  `-'\_)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu