• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Strange results when converting NSDate timeIntervalSinceReferenceDate to NSPoint
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange results when converting NSDate timeIntervalSinceReferenceDate to NSPoint


  • Subject: Strange results when converting NSDate timeIntervalSinceReferenceDate to NSPoint
  • From: Gilles Celli <email@hidden>
  • Date: Sat, 27 Jan 2007 13:47:03 +0100

Hi,

I need to convert NSDate to a meaningful NSPoint for the x-Axis of my plotting application, so that the graph plots
the points to the corresponding time of the current day. The application itself is a data acquisition app which acquires
every 0.5 seconds data from a digital Multimeter connected on the USB port.


For Plotting / Graphing I'm using the excellent SM2DGraphView open- source plotting framework:
http://developer.snowmintcs.com/frameworks/sm2dgraphview/


But I get strange results when converting NSDate timeIntervalSinceReference to NSPoint.

Example:

[code] ------------------------------------------------------------------------ -----------------------------------------------------

NSPoint *graphData

for ( iRow = 0; iRow < curRow ; iRow++ )
{
// map the NSDate to a meaningful X co-ordinate.
graphData[iRow].x = [ k2700_str[iRow].acqDate timeIntervalSinceReferenceDate ];

// Store the voltage value of the multimeter to
graphData[iRow].y = k2700_str[iRow].channel;


NSLog(@"acqDate as timeIntervalSRDate: %f | graphData.x = %f ", [ k2700_str[iRow].acqDate
timeIntervalSinceReferenceDate ], graphData[iRow].x );
}


[/code] ------------------------------------------------------------------------ -----------------------------------------------------

[Result]

2007-01-26 18:09:30.599 AcquiKeithley[11852] acqDate as timeInterval: 191524170.000177 | graphData.x = 191524176.000000 =============> different value !!!!

2007-01-26 18:09:30.600 AcquiKeithley[11852] acqDate as timeInterval: 191524170.500054 | graphData.x = 191524176.000000 =============> different value !!!!

[Result]

So you see I get a different values. I tried to do a cast to (float) but it didn't work.
I'm sure that I'm making something wrong.... :-(


Does anyone have any clues ?

Any help greatly appreciated. Thanks.

Gilles Celli



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Strange results when converting NSDate timeIntervalSinceReferenceDate to NSPoint
      • From: James Bucanek <email@hidden>
  • Prev by Date: NSAttributedString and PDF
  • Next by Date: Re: KVO, design and documentaion
  • Previous by thread: Re: NSAttributedString and PDF
  • Next by thread: Re: Strange results when converting NSDate timeIntervalSinceReferenceDate to NSPoint
  • Index(es):
    • Date
    • Thread