strftime and 10th of a second?

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

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

Hi Fred,

Thanks for your help!

Cheers, Birgit