DateTime optionally containing microseconds

Hi all,

I’m sending DateTimes over soap to JADE agent system.

If I send DateTime.now over it is accepted fine… and ends up as:

2009-09-30T09:20:52.959452-03:00

However, if I convert a Rails model field to datetime and send it over
its of class DateTime but loses the microseconds. Which my SOAP
server inconveniently requires to be present.

@seller.deadline.to_datetime

ends up as:

2009-09-29T23:20:00-03:00

And is rejected.

I was able to get @seller.deadline.to_datetime to be accepted by
adding the microsecond portion of DateTime.now to it. But that seems
like an awful hack.

How do I ensure a given DateTime such as the one extracted from a
rails model is alays sent with the microsecond portion present over
SOAP?

thanks,
Aaron

    obj = EcommercePort.new
    obj.wiredump_dev = STDERR if $DEBUG

    time_periods = ArrayOfSellerTimePeriod.new
    #time_periods[0] = SellerTimePeriod.new

(@seller.deadline.to_datetime, @seller.openingOffer, @seller.alpha,
@seller.umin, @seller.deadline.to_datetime)
time_periods[0] = SellerTimePeriod.new
(@seller.deadline.to_datetime + DateTime.now.sec_fraction,
@seller.openingOffer.to_f, @seller.alpha, @seller.umin, DateTime.now)

    p time_periods[0]

    parameters = {
      :sellerID => @seller.sellerID,
      :maxPossPrice => @seller.openingOffer.to_f,
      :itemID => @seller.itemID,
      :deadline => DateTime.now,
      :timePeriods => time_periods
    }


    puts obj.clientGatewayCreateNewSeller(parameters)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs