You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@superset.apache.org by GitBox <gi...@apache.org> on 2018/04/23 05:02:49 UTC

[GitHub] mistercrunch closed pull request #3670: Fix the epoch_s & epoch_ms calculations

mistercrunch closed pull request #3670: Fix the epoch_s & epoch_ms calculations
URL: https://github.com/apache/incubator-superset/pull/3670
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 24fd2bfbab..22b78dab36 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -108,9 +108,9 @@ def dttm_sql_literal(self, dttm):
         if self.database_expression:
             return self.database_expression.format(dttm.strftime('%Y-%m-%d %H:%M:%S'))
         elif tf == 'epoch_s':
-            return str((dttm - datetime(1970, 1, 1)).total_seconds())
+            return str((dttm - datetime.fromtimestamp(0)).total_seconds())
         elif tf == 'epoch_ms':
-            return str((dttm - datetime(1970, 1, 1)).total_seconds() * 1000.0)
+            return str((dttm - datetime.fromtimestamp(0)).total_seconds() * 1000.0)
         else:
             s = self.table.database.db_engine_spec.convert_dttm(
                 self.type or '', dttm)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services