From: Reid Thompson Date: 2009-10-01T09:27:55+09:00 Subject: Re: Can you make a clock? Scott Andrechek wrote: > I have tried all 3 tips and although i see how it would work maybe if i > be more specific it'll help you help me : ) . I am making a program > notify me how many days are left till an event happens (in the case of > my program when a game comes out). This is what I use: > > puts 'Hey Scott : D' > time=Time.new > time_cod=Time.mktime(2009,11,13) > time_operationflash=Time.mktime(2009,10,6) > time_assassinscreed2=Time.mktime(2009,11,17) > time_godofwar3=Time.mktime(2010,3) > if (time_cod.to_i<0 or time_cod.to_i==0) > puts 'It\'s already out!' > else > puts 'There are ' + (((((time_cod-time)/60)/60)/24).to_i).to_s + ' > days left until Call of Duty 4: Modern Warfare 2 is released' > end > if (time_operationflash.to_i<0 or time_operationflash.to_i==0) > puts 'It\'s already out!' > else > puts 'There are ' + > (((((time_operationflash-time)/60)/60)/24).to_i).to_s + ' days left > until Operation Flashpoint: Dragon Rising is released' > end > if (time_assassinscreed2.to_i<0 or time_assassinscreed2==0) > puts 'It\'s already out!' > else > puts 'There are ' + > (((((time_assassinscreed2-time)/60)/60)/24).to_i).to_s + ' days left > until Assassin\'s Creed 2 is released' > end > if (time_godofwar3.to_i<0 or time_godofwar3.to_i==0) > puts 'It\'s already out!' > else > puts 'There are ' + (((((time_godofwar3-time)/60)/60)/24).to_i).to_s > + ' days left until God of War 3 is released' > end > sleep 50 > > I use sleep so I can start it without the command line. This does work > outputting: > Hey Scott : D > There are 43 days left until Call of Duty 4: Modern Warfare 2 is > released > There are 5 days left until Operation Flashpoint: Dragon Rising is > released > There are 47 days left until Assassin's Creed 2 is released > There are 151 days left until God of War 3 is released > > I would like to change it that would say how many months, days, hours, > minutes, and seconds are left. Thanks again. > > -Scott google ruby chronic