Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Robert Sebille
AaaaHorodatage
Commits
dba60296
Commit
dba60296
authored
Jun 15, 2018
by
Robert Sebille
Browse files
+ and - operators return now an ts_object; error 42 update.
parent
7a03d45f
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
dba60296
...
...
@@ -157,27 +157,26 @@ Consider this tips:
### + operator
+
operator:
new_ts = ts
+ nb_seconds
update and return
self.ts
+ nb_seconds
+
operator:
ts_object = ts_object
+ nb_seconds
update
self.ts
and return
ts_object
+ nb_seconds
Add nb_seconds at timestamp
Tips:
-
use dhms2second(d=0, h=0, m=0, s=0) utility method
to convert days + hours + minutes + seconds in seconds
-
To add seconds to a new timestamp instance:
new_ts_object = ts_object.copy()
new_ts_object - seconds
new_ts_object -
nb_
seconds
### - operator
- operator: new_ts = ts_object - *nb_seconds_or_ts_object
if *nb_seconds_or_ts_object is a nb_seconds integer
update and return
self.ts
- *nb_seconds
update
self.ts
and return
ts_object
- *nb_seconds
self.ts seconds - seconds must be >= 0 (epoch-01-01)
if *nb_seconds_or_ts_object is ts_object, call
self.ts.diffDays("string", *nb_seconds_or_ts_object.get_ts())
self.ts is NOT updated.
_See this method above_
self.ts is NOT updated. See diffDays() method above.
Tips:
- use dhms2second(d=0, h=0, m=0, s=0) utility method
...
...
aaaa/ahordattools.py
View file @
dba60296
...
...
@@ -89,11 +89,13 @@ class AaaaHorodatageTools(AaaaHorodatage):
# protected #
# attributs
def
_get_Aaaa42
(
self
):
print
(
self
.
_Aaaa42
)
douglas
=
open
(
"aaaa/42"
,
"r"
)
print
(
douglas
.
read
())
douglas
.
close
()
print
(
"
\n
Fatal error 42: existential error 101010.
\n
System halted."
)
sys
.
exit
(
42
)
Aaaa
42
=
property
(
_get_Aaaa42
)
_
42
=
property
(
_get_Aaaa42
)
# Special #
def
copy
(
self
):
...
...
@@ -148,7 +150,7 @@ class AaaaHorodatageTools(AaaaHorodatage):
return
self
.
get_ts
()
def
__add__
(
self
,
seconds
=
0
):
"""
Add seconds to self.ts and return self.t
s.
"""
new_ts = ts_object + second
s.
Overload of plus operator.
self.ts will be updated
...
...
@@ -168,7 +170,7 @@ class AaaaHorodatageTools(AaaaHorodatage):
ts_seconds
=
int
(
tmp
/
10000
)
ts_seconds
+=
seconds
self
.
ts
=
str
(
ts_seconds
)
+
str
(
ts_epoch
)
+
"Z"
+
ts_offset
return
self
.
ts
return
self
def
__sub__
(
self
,
*
nb_seconds_or_ts_object
):
"""new_ts = ts_object - *nb_seconds_or_ts_object
...
...
@@ -209,7 +211,7 @@ class AaaaHorodatageTools(AaaaHorodatage):
print
(
"Program halted."
)
sys
.
exit
(
53
)
self
.
ts
=
str
(
ts_seconds
)
+
str
(
ts_epoch
)
+
"Z"
+
ts_offset
return
self
.
ts
return
self
# protected #
# méthodes
...
...
main.py
View file @
dba60296
...
...
@@ -138,6 +138,8 @@ if __name__ == "__main__":
print
(
myDT
.
decode
(),
" <= "
,
myKb
.
decode
(),
": "
,
myDT
<=
myKb
)
print
(
myDT
.
decode
(),
" > "
,
myKb
.
decode
(),
": "
,
myDT
>
myKb
)
print
(
myDT
.
decode
(),
" >= "
,
myKb
.
decode
(),
": "
,
myDT
>=
myKb
)
print
(
"("
,
myDT
.
decode
(),
" + 10T01:10:20) > "
,
myKb
.
decode
(),
": "
,
(
myDT
+
myDT
.
dhms2seconds
(
10
,
1
,
10
,
20
))
>
myKb
)
rep
=
True
while
rep
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment