[futurebasic] Re: [FB] Code to calculate day of the year

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2008 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Fri, 17 Oct 2008 08:18:43 -0700
On Oct 17, 2008, at 3:41 AM, Steve wrote:

> Thanks again for your help Brian
>
> I will try these suggestions today.
>
>

The CFTimeZoneCopySystem call follows the "Create Rule", so its  
CFTimeZoneRef needs to be CFReleased. The following function corrects  
that error.

'------------
local fn GetDayOfYear( d as ^CFGregorianDate )
'~'1
dim as CFTimeZoneRef     timeZone
dim as CFAbsoluteTime    at
dim as SInt32            dayOfYear

timeZone = fn CFTimeZoneCopySystem()//get the machines local time zone

at = fn CFGregorianDateGetAbsoluteTime_Glue#( #d, timeZone )
dayOfYear = fn CFAbsoluteTimeGetDayOfYear( at , timeZone )
CFRelease( timeZone )

end fn = dayOfYear
'------------
Brian