From 8f414f9c3357090d872cc4535de42ff271f5b0fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petrus=20Hyv=C3=B6nen?= <petrus.hyvonen@sscspace.com>
Date: Sun, 13 Nov 2016 12:55:11 +0100
Subject: [PATCH] Updated absolutedate conversions from incorrect millisecond
 conversoins

---
 orekit-conda-recipe/CHANGES.txt  |  3 +++
 orekit-conda-recipe/meta.yaml    |  2 +-
 orekit-conda-recipe/pyhelpers.py | 21 ++++++++++++++++++++-
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/orekit-conda-recipe/CHANGES.txt b/orekit-conda-recipe/CHANGES.txt
index f9a916f..6422a32 100644
--- a/orekit-conda-recipe/CHANGES.txt
+++ b/orekit-conda-recipe/CHANGES.txt
@@ -1,5 +1,8 @@
 Changelog python orekit package
 
+2016-11-13 Version 8.0 Build 1
+- Corrected the datetime to absolute conversions, microseconds was incorrectly converted
+
 2016-07-03 Version 8.0 Build 0
 - Updated to orekit 8.0 version with fixes as of 3rd July
 - Changed from apache common maths3 to hipparhcus
diff --git a/orekit-conda-recipe/meta.yaml b/orekit-conda-recipe/meta.yaml
index 106d589..a7dae07 100644
--- a/orekit-conda-recipe/meta.yaml
+++ b/orekit-conda-recipe/meta.yaml
@@ -6,7 +6,7 @@ build:
 
   # If this is a new build for the same version, increment the build
   # number. If you do not include this key, it defaults to 0.
-  number: 0
+  number: 1
   # Builds:
   # 1 - orekit 7.1dev0 version from git 2015-10-05
   # 2 - orekit 7.1dev0 version from git 2015-12-17
diff --git a/orekit-conda-recipe/pyhelpers.py b/orekit-conda-recipe/pyhelpers.py
index ab39a81..0e2064d 100644
--- a/orekit-conda-recipe/pyhelpers.py
+++ b/orekit-conda-recipe/pyhelpers.py
@@ -67,7 +67,26 @@ def absolutedate_to_datetime(orekit_absolutedate):
                     or_time.getHour(),
                     or_time.getMinute(),
                     int(math.floor(seconds)),
-                    int(1000.0 * (seconds - math.floor(seconds))))
+                    int(1000000.0 * (seconds - math.floor(seconds))))
+
+def datetime_to_absolutedate(dt_date):
+    ''' Converts between orekit.AbsoluteDate objects
+    and python datetime objects (utc)
+
+    Args:
+        dt_date (datetime): python datetime object to convert
+
+    Returns:
+        AbsoluteDate: time in orekit format'''
+
+    utc = TimeScalesFactory.getUTC()
+    return AbsoluteDate(dt_date.year,
+                        dt_date.month,
+                        dt_date.day,
+                        dt_date.hour,
+                        dt_date.minute,
+                        dt_date.second + dt_date.microsecond / 1000000.,
+                        utc)
 
 
 def to_elevationmask(az, el):
-- 
GitLab