Posted by
Dirk Eddelbuettel on
Aug 07, 2014; 1:10pm
URL: http://quantlib.414.s1.nabble.com/Intra-day-date-representation-tp15688p15709.html
On 7 August 2014 at 15:05, Luigi Ballabio wrote:
| On Thu, Aug 7, 2014 at 2:52 PM, Dirk Eddelbuettel <
[hidden email]> wrote:
| > | So: let's start the discussion. I'd love to hear from people with some
| > | ideas about the above...
| >
| > Why don't start by generalizing Date :) (Only half-kidding, maybe incremental
| > approaches are fine rather than grand rewrite that then may stall ...)
|
|
| That one should be doable.
| Possibility 1: we add a time part to our date and keep track of it in
| day counters.
| Possibility 2: we change the internals of our date so that it contains
| a Boost date, we check that it works as before, then we also expose
| the time part (and keep track of it in day counters). At a later date
| (ha ha) we gut our date and keep Boost. Question: is Boost.Date
| header-only or do we need to link a library?
Yay!
This day is going to be a winner as *I* get to answer a question by Luigi :)
>From my
https://github.com/eddelbuettel/rcppbdt package which bring some
Boost.Date goodness to R (via Rcpp, of course):
// Setting this variable governs whether we need to link against the
// Boost Date.Time library (eg -lboost_date_time on Debian/Ubuntu) or
// not The functions not involving string parsing or conversion are
// all available via the templated Boost header files and are thus
// compile-time only which make things a little easier.
// On Windows, set the BOOSTLIB variable to point to a suitable directory.
// On other systems, just have Boost in the include path
#define RcppBDT_UseWithStrings 0
#if RcppBDT_UseWithString
#include <boost/date_time/gregorian/gregorian.hpp> // Gregorian calendar types, with I/O
#else
#include <boost/date_time/gregorian/gregorian_types.hpp> // Gregorian calendar types, no I/O
#endif
So just include gregorian_types.hpp and you remain header-only, foregoing
only date formatting and parsing for which the library is needed.
Dirk
--
http://dirk.eddelbuettel.com | @eddelbuettel |
[hidden email]
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev