PR# 2301 Make DATE_TIME from file modification time.

Problem Report Summary
Submitter:
Category: EiffelTime
Priority: Medium
Date: 2000/01/10
Class: Feature Request
Severity: Non-critical
Number: 2301
Release: 4.5
Confidential: No
Status: Analyzed
Responsible:
Environment: Mozilla/4.5 [en] (WinNT; I)
Synopsis: Make DATE_TIME from file modification time.

Description
File modification time (feature `date' in the FILE class) is given in seconds 
from the Epoch (00:00:00 UTC, January 1, 1970).
I want to display this time with correction for local time zone and daylight
savings.
I cannot find any method to do that in the DATE_TIME cluster.
Is there some method that I missed or are you planning to add it?

My fix is included under "To reproduce".

Regards,
Lennart Gustafsson
Enea
To Reproduce
Eiffel:
	utc_seconds_to_date_time (utc: INTEGER): DATE_TIME is
			-- Date and time converted from time in seconds
			-- since the Epoch (00:00:00 UTC, January 1, 1970)
			-- Time zone and daylight savings corrections are 
			-- made before conversion.
		local
			i: INTEGER
		do
			create Result.make (1970, 1, 1, 0, 0, 0)
			i := c_local_time_correction (utc)
			Result.second_add (utc + i)
		end
	
	c_local_time_correction (utc: INTEGER): INTEGER is
		external
			"C [macro <dt_test.h>]"
		end

C:
int
l_local_time_correction(int sec)
{
  tm_struct = localtime((time_t*)(&sec));
  return tm_struct->tm_isdst*3600-_timezone;
}

#define c_local_time_correction(sec) l_local_time_correction(sec)
Problem Report Interactions
From:    Date:2000/01/10    Download   
State-Changed-From-To: open-analyzed
State-Changed-By: Arnaud
State-Changed-When: Mon Jan 10 10:44:55 PST 2000
State-Changed-Why:
Thank you very much for this report. The local time function is currently not implemented but will be in our next release.

We will certainly use the same method as you did.

Hope this helps,
Arnaud.

Responsible-Changed-From-To: SupportMan-David_S
Responsible-Changed-By: Arnaud
Responsible-Changed-When: Mon Jan 10 10:44:55 PST 2000
Responsible-Changed-Why:
This person is in charge of the DATE_TIME library