Hi all, I''m using JRuby on Rails 2.x One of the requirements of my project is to create a recordings filename that includes date and time. This is what I''ve got so far. now = Time.new @record_filename = "<path>" @record_filename += now.strftime("%Y-%m-%d-%H-%M-%S") @record_filename += ".wav" Because some of these files can be create at the same time, I need to include a unit that is smaller than seconds, like a 10th of a seconds. I searched, but it seems that this not possible in strftime(). Is that correct? If so, any idea how to solve this? Counting is not an option. Thanks, Birgit -- -- Birgit Arkesteijn, birgit-YRFHH29wTjy9FHfhHBbuYA@public.gmane.org, -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK -- Company no: 1769350 -- Registered Office: -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. -- tel.: +44 (0)161 237 0660 -- <URL: http://www.westhawk.co.uk> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 3 Sep 2008, at 17:53, Birgit Arkesteijn <birgit-YRFHH29wTjy9FHfhHBbuYA@public.gmane.org> wrote:> > Hi all, > > I''m using JRuby on Rails 2.x > > One of the requirements of my project is to create a recordings > filename > that includes date and time. This is what I''ve got so far. > > now = Time.new > @record_filename = "<path>" > @record_filename += now.strftime("%Y-%m-%d-%H-%M-%S") > @record_filename += ".wav" > > Because some of these files can be create at the same time, I need to > include a unit that is smaller than seconds, like a 10th of a seconds. > > I searched, but it seems that this not possible in strftime(). > Is that correct? If so, any idea how to solve this? > Counting is not an option.Just do it yourself: x.strftime(...) + x.usec.to_s or something along those lines. Fred> > > Thanks, Birgit > > -- > -- Birgit Arkesteijn, birgit-YRFHH29wTjy9FHfhHBbuYA@public.gmane.org, > -- Westhawk Ltd, Albion Wharf, 19 Albion Street, Manchester M1 5LN, UK > -- Company no: 1769350 > -- Registered Office: > -- 15 London Road, Stockton Heath, Warrington WA4 6SJ. UK. > -- tel.: +44 (0)161 237 0660 > -- <URL: http://www.westhawk.co.uk> > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 03/09/08 16:59, Frederick Cheung wrote:> > On 3 Sep 2008, at 17:53, Birgit Arkesteijn <birgit-YRFHH29wTjy9FHfhHBbuYA@public.gmane.org> > wrote: > >> Hi all, >> >> I''m using JRuby on Rails 2.x >> >> One of the requirements of my project is to create a recordings >> filename that includes date and time. This is what I''ve got so far. >> >> now = Time.new >> @record_filename = "<path>" >> @record_filename += now.strftime("%Y-%m-%d-%H-%M-%S") >> @record_filename += ".wav" >> >> Because some of these files can be create at the same time, I need to >> include a unit that is smaller than seconds, like a 10th of a seconds. >> >> I searched, but it seems that this not possible in strftime(). >> Is that correct? If so, any idea how to solve this? >> Counting is not an option.>> >> Thanks, Birgit>>> Just do it yourself: x.strftime(...) + x.usec.to_s or something along > those lines. > > FredHi Fred, Thanks for your help! Cheers, Birgit --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---