Skip to content

Commit

Permalink
microseconds is 0 where date is None
Browse files Browse the repository at this point in the history
  • Loading branch information
djkirkham committed Sep 15, 2016
1 parent e6f6ab1 commit 3bc6d71
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cf_units/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ def _num2date_to_nearest_second(time_value, utime):
dates = utime.num2date(time_values)
try:
# We can assume all or none of the dates have a microsecond attribute
microseconds = np.array([d and d.microsecond for d in dates])
microseconds = np.array([d.microsecond if d else 0 for d in dates])
except AttributeError:
microseconds = 0
round_mask = np.logical_or(has_half_seconds, microseconds != 0)
Expand Down

0 comments on commit 3bc6d71

Please sign in to comment.