From: Hal Fulton Date: 2003-12-04T16:24:46+09:00 Subject: Re: Swatch's internet time in Ruby [Code Inside] Pablo Lorenzzoni wrote: > Hello ALL! > > Just wanted to share... maybe someone have a better way to do this: > > ---------- > class Time > > def bmt_hour > h = self.gmtime.hour + 1 > return 0 if h == 24 > return h > end > > def beats > ((self.bmt_hour * 60 * 60) + (self.min * 60) + self.sec) / 86.4 > end > > protected :bmt_hour > end > ---------- > > require('beats.rb') and Time.now.beats returns the Internet Time in beats I have no problem with the coding style... there are various ways of doing it. But is this correct? Beat 0 isn't midnight GMT, is it? Isn't there a time zone difference? Maybe I'm wrong. I wrote similar code in _The Ruby Way_, but I've forgotten the details. Cheers, Hal