[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] DateTime..what is the AB numerical format?



PureBytes Links

Trading Reference Links

Hello,

>route seems cumbersome and  unnecessary...

It amuses me to no end when such posts appear from time to time.
Every now and then someone starts thinking that I designed something
plain stupid.

And the answer always is: there is NOTHING in AmiBroker coming without
VERY GOOD REASON.

Microsoft DATE format needs 8 BYTES.

AmiBroker DateTime needs **half** of that (i.e. 4 BYTES).

It was designed to conserve space. While it is not a problem for one date/time,
once you want to store half million bars with timestamps such small difference
yields 2MB of RAM of savings PER SYMBOL.

Subtraction / addition by "number" does not work - it was never supposed to work that way.
The format was designed to be very fast at sec/min/hour/day/month/year <-> datetime conversion,
which is needed millions of times and not for numerical "subtraction" of dates which is never needed in AmiBroker
itself.

(If you now start to wonder why not use C time_t  (4 bytes too) - then the answer
is - this format is also not good because it is valid ONLY for years 1970-2023,
while AmiBrokers' date time covers 1900-2155)


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "Andy Davidson" <AndyDavidson@xxxxxxxxxxxxx>
To: "Amibroker Yahoo Group" <amibroker@xxxxxxxxxxxxxxx>
Sent: Wednesday, January 24, 2007 1:54 PM
Subject: [amibroker] DateTime..what is the AB numerical format?


> I'm confused regarding the *numerical* format of DateTime.
> 
> From my research there seems to be a factor of 10^9 difference between 
> what AB reports as the DateTime number, using Now(Format=5), and what 
> Microsoft say the value should be according to their standard for 
> today's date.
> 
> Can anyone explain why? My attempts to add/subtract numbers to the 
> DateTime figure and then convert back to a string have failed 
> miserably...I've guesstimated that 1-second is 6*10^16 in AB (as opposed 
> to 1*10^7 on the MS help pages), but this does not seem to be the case.
> 
> So it seems that I will have to go the long-winded way of breaking the 
> date and time into components and playing with the arithmetic. Although 
> within my understanding, this route seems cumbersome and 
> unnecessary...is the conclusion correct that simple numerical 
> manipluation of the DateTime number in AB is not possible?
> 
> Grateful for any enlightenment.
> 
> Andy
> 
> 
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>

Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.5/645 - Release Date: 1/22/2007 4:10 PM