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 = “”
@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 A., [email protected],
– 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>

On 3 Sep 2008, at 17:53, Birgit A. [email protected]
wrote:

@record_filename = “”
@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

On 03/09/08 16:59, Frederick C. wrote:

Counting is not an option.

Thanks, Birgit

Just do it yourself: x.strftime(…) + x.usec.to_s or something along
those lines.

Fred

Hi Fred,

Thanks for your help!

Cheers, Birgit