Thanks a lot for reporting this I would surely have been caught (may be I am I'll go through code I wrote using this) by this bug.<br>Posting your workaround would not hurt I think...<br><br>Thanks and cheers<br><br><div class="gmail_quote">
2013/3/30 Robin Girard <span dir="ltr"><<a href="mailto:robin.girard@mines-paristech.fr" target="_blank">robin.girard@mines-paristech.fr</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks you're right  I already wrote it myself with getFractional...<br>
and indeed that's not really what we should call a "bug" but it took me a while to understand that<br>
<br>
if date1-date2>0  then date1<date2 ;)<br>
<br>
R.<br>
<br>
<br>
----- Mail original -----<br>
De: "Dirk Eddelbuettel" <<a href="mailto:edd@debian.org">edd@debian.org</a>><br>
À: "Robin Girard" <<a href="mailto:robin.girard@mines-paristech.fr">robin.girard@mines-paristech.fr</a>><br>
Cc: <a href="mailto:rcpp-devel@lists.r-forge.r-project.org">rcpp-devel@lists.r-forge.r-project.org</a><br>
Envoyé: Samedi 30 Mars 2013 00:44:08<br>
Objet: Re: [Rcpp-devel] Datetime substraction bug ?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 29 March 2013 at 23:37, Robin Girard wrote:<br>
| Hi List<br>
|<br>
| why is it that we have in the Datetime definition<br>
| (here <a href="http://dirk.eddelbuettel.com/code/rcpp/html/Date_8cpp_source.html#l00271" target="_blank">http://dirk.eddelbuettel.com/code/rcpp/html/Date_8cpp_source.html#l00271</a> )<br>
|<br>
| double operator-(const Datetime& d1, const Datetime& d2) { return d2.m_dt - d1.m_dt; }<br>
| bool operator<(const Datetime &d1, const Datetime& d2) { return d1.m_dt < d2.m_dt; }<br>
|<br>
| I feel there is a contradiction<br>
| substraction shoulb be d1.m_dt - d2.m_dt;  no ?<br>
<br>
It's been a while since I wrote that and I think I followed the difftime()<br>
convention in R. Or maybe not.  To me d1 comes before d2 in the way the<br>
arguments are given, so d2 is larger and I want to subtract d1 from d2.<br>
<br>
In any event, if it bugs you greatly you are always free to write your own<br>
function. ;-)<br>
<br>
Dirk<br>
<br>
|<br>
| Robin<br>
|<br>
| Dr. Girard Robin<br>
| Chargé de Recherche<br>
|<br>
| MINES-ParisTech / Département Energétique et Procédés / PERSEE / Groupe ERSEI<br>
| Centre Procédés, Energies Renouvelables et Systèmes Energétiques (PERSEE)<br>
| Center for Processes, Renewables Energies and Energy Systems<br>
| Renewable Energies & Smartgrids (ERSEI)<br>
|<br>
| 1 Rue Claude Daunesse - CS 10207 - F-06904 Sophia Antipolis Cedex<br>
| Tel: +33.4.93.67.89.64 (~99), Fax: +33.4.93.95.75.35<br>
| e-mail : <a href="mailto:robin.girard@mines-paristech.fr">robin.girard@mines-paristech.fr</a><br>
|<br>
| web page perso <a href="http://www.mines-paristech.fr/Services/Annuaire/&?id=8828" target="_blank">http://www.mines-paristech.fr/Services/Annuaire/&?id=8828</a><br>
| statoverflow : <a href="http://stats.stackexchange.com/users/223/robin-girard" target="_blank">http://stats.stackexchange.com/users/223/robin-girard</a><br>
| web page centre PERSEE : <a href="http://www.cep.mines-paristech.fr/" target="_blank">http://www.cep.mines-paristech.fr/</a><br>
| linkedin : <a href="http://www.linkedin.com/profile/view?id=14907272&trk=tab_pro" target="_blank">http://www.linkedin.com/profile/view?id=14907272&trk=tab_pro</a><br>
|<br>
| Le lien vaut mieux que le bien.<br>
| ________________________________________________________<br>
|<br>
| CONFIDENTIALITY : This  e-mail  and  any attachments are<br>
| confidential and may be privileged. If  you are not a<br>
| named recipient, please notify the sender immediately and<br>
| do not disclose the contents to another person, use it for<br>
| any purpose or store or copy the information in any medium.<br>
|<br>
| CONFIDENTIALITE : Ce message et les éventuelles pièces<br>
| attachées sontconfidentiels et peuvent être une<br>
| communication protégée. Si vous n'êtes pas dans la liste<br>
| des destinataires, veuillez informer l'expéditeur<br>
| immédiatement et ne pas ouvrir ni divulguer le contenu<br>
| à une tierce personne, ne pas l'utiliser pour quelque<br>
| raison que ce soit, ne pas stocker ou copier l'information<br>
| qu'il contient sur un quelconque support.<br>
|<br>
| _______________________________________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
_______________________________________________<br>
Rcpp-devel mailing list<br>
<a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a></div></div></blockquote></div><br>