|
49 | 49 | string_types = str |
50 | 50 |
|
51 | 51 | EMPTYANNOTATION = "EMPTYLIST" |
| 52 | +DATETIMEANNOTATION = "DATETIME" |
52 | 53 |
|
53 | 54 |
|
54 | 55 | def stringify(value): |
@@ -1199,7 +1200,8 @@ def _write_property(self, section, name, v): |
1199 | 1200 | section.create_property(name, v.magnitude.item()) |
1200 | 1201 | section.props[name].unit = str(v.dimensionality) |
1201 | 1202 | elif isinstance(v, datetime): |
1202 | | - section.create_property(name, calculate_timestamp(v)) |
| 1203 | + prop = section.create_property(name, calculate_timestamp(v)) |
| 1204 | + prop.definition = DATETIMEANNOTATION |
1203 | 1205 | elif isinstance(v, string_types): |
1204 | 1206 | if len(v): |
1205 | 1207 | section.create_property(name, v) |
@@ -1238,8 +1240,7 @@ def _write_property(self, section, name, v): |
1238 | 1240 | values.append(item) |
1239 | 1241 | section.create_property(name, values) |
1240 | 1242 | section.props[name].unit = unit |
1241 | | - if definition: |
1242 | | - section.props[name].definition = definition |
| 1243 | + section.props[name].definition = definition |
1243 | 1244 | elif type(v).__module__ == "numpy": |
1244 | 1245 | section.create_property(name, v.item()) |
1245 | 1246 | else: |
@@ -1274,6 +1275,8 @@ def _nix_attr_to_neo(nix_obj): |
1274 | 1275 | values = "" |
1275 | 1276 | elif len(values) == 1: |
1276 | 1277 | values = values[0] |
| 1278 | + if prop.definition == DATETIMEANNOTATION: |
| 1279 | + values = datetime.fromtimestamp(values) |
1277 | 1280 | neo_attrs[prop.name] = values |
1278 | 1281 | neo_attrs["name"] = stringify(neo_attrs.get("neo_name")) |
1279 | 1282 |
|
|
0 commit comments