From: Daniel Bretoi Date: 2003-05-17T04:34:41+09:00 Subject: Re: need help with timestamping Hi all, This worked, not as pretty as I'd liked, but... class Time def stamp(filename) fh = File.open(filename,"w+") fh.puts "#{self.to_a.inspect}" fh.close end def Time.readStamp(filename) fh = File.open(filename) a = eval fh.readline mktime(*a) end end a = Time.now a.stamp("blah") p Time.readStamp("blah") On Sat, May 17, 2003 at 03:49:20AM +0900, Daniel Bretoi wrote: > Hi, > > I want to write a timestamp to a file, then read it in, and get a time > object again. > > I've useusally done this with something like, epoch times > > a Time.now > file.puts a.epoch > > ... > > f = file.read > b = mktime(f) > > but I can't seem to find a native way of doing this. > > is there? > > db > > > -- > May 16 First report on SNOBOL distributed (within BTL), 1963 > May 17 24" rain in 11 hours, Pearl River, S. China, 1982 > May 17 Six SLA members killed in televised gun fight, 1974 > May 18 Battle of Las Piedras in Uruguay > May 18 Napoleon crowned Emperor, 1804 > May 16 Discovery Day in Cayman Islands > May 17 Constitution Day in Nauru and Norway > May 18 Flag Day in Haiti > May 18 Prayer Day in Denmark > May 18 Rick Wakeman is born in West London, England, 1949 > May 17* Armed Forces Day (3rd Saturday of May) > May 16* Omer 49th day > May 17* Erev Shavout > May 18* Shavuot (Festival of Weeks; 50 days after Pesach) > May 18* Yizkor -- May 16 First report on SNOBOL distributed (within BTL), 1963 May 17 24" rain in 11 hours, Pearl River, S. China, 1982 May 17 Six SLA members killed in televised gun fight, 1974 May 18 Battle of Las Piedras in Uruguay May 18 Napoleon crowned Emperor, 1804 May 16 Discovery Day in Cayman Islands May 17 Constitution Day in Nauru and Norway May 18 Flag Day in Haiti May 18 Prayer Day in Denmark May 18 Rick Wakeman is born in West London, England, 1949 May 17* Armed Forces Day (3rd Saturday of May) May 16* Omer 49th day May 17* Erev Shavout May 18* Shavuot (Festival of Weeks; 50 days after Pesach) May 18* Yizkor