Commit c862de8c authored by Robert Sebille's avatar Robert Sebille
Browse files

Libération de l'année de la limite 9999

parent ed950b17
......@@ -25,6 +25,8 @@ __Below, in the same directory as this README.md file__
utc=True: UTC encoding
decode("typ", ts) typ = "string", "list", "dict" ou "dictionary"
NB: encode year > 9999 with an epoch = 1000 can causes long calculations.
## Timezones
### Setting your timezone
Your local timezone is stored in _utc_local_offset_ attribute
......
......@@ -10,7 +10,7 @@
Class attribute(s)
- epoch: class reference year of the timestamp (only for encoding).
Range: 1000 <= epoch <= year <= 10000. Default 2000.
Range: 1000 <= epoch <= 9999. Default 2000.
Several ranges and keyboard input are managed, but not exceptions.
......@@ -345,8 +345,10 @@ class AaaaHorodatage:
seconds: minutes: hour: year: month: day:
Ranges: seconds, minutes: 0-59. hour: 0-23.
year: epoch <= year <= 10000. month: 1-12.
day: 1-28/29/30/31, exact for the month.
year: >= epoch, month: 1-12, day: 1-28/29/30/31,
exact for the month.
NB: encode year > 9999 with en epoch = 1000
can causes long calculations.
utc: True, UTC timezone (default) | False, local timezone
......@@ -380,11 +382,12 @@ class AaaaHorodatage:
# on vérifie les plages des entrées listes, tuples, dictionnaires
if isinstance(d, list) or isinstance(d, tuple) or isinstance(d, dict):
self.erreur = ""
if self.annee < self.get_epoch() or self.annee > 9999:
# if self.annee < self.get_epoch() or self.annee > 9999:
if self.annee < self.get_epoch():
self.erreur = "Fatal error 3, year = " + str(self.annee) + \
". It must be [" + \
". It must be [>= " + \
str(self.get_epoch()) +\
"-9999, integer] in encode."
", integer] in encode."
if self.mois < 1 or self.mois > 12:
self.erreur = "Fatal error 3, month = " + str(self.mois) + \
". It must be [1-12, integer] in encode."
......@@ -415,9 +418,10 @@ class AaaaHorodatage:
# keyboard
if d == "":
print("Coding a timestamp from the keyboard:")
self.annonce = "Year [" + str(self.get_epoch()) +\
"-9999, integer]: "
while self.annee < self.get_epoch() or self.annee > 9999:
self.annonce = "Year [>= " + str(self.get_epoch()) +\
", integer]: "
# while self.annee < self.get_epoch() or self.annee > 9999:
while self.annee < self.get_epoch():
print(self.annonce, end="")
self.annee = self._input_entier()
# self.annee = int(input(self.annonce))
......
......@@ -11,7 +11,7 @@
Class attribute(s)
- epoch: class reference year of the timestamp (only for encoding).
Range: 1000 <= epoch <= year <= 10000. Default 2000.
Range: 1000 <= epoch <= 9999. Default 2000.
Several ranges and keyboard input are managed, but not exceptions.
......@@ -116,8 +116,8 @@ class AaaaHorodatageTools(AaaaHorodatage):
ts1_split = self.ts1.split("Z")
ts2_split = self.ts2.split("Z")
if ts1_split[1] != ts2_split[1]:
print("Fatal error 51: offset UTC1" + ts1_split[1] +
" does not match offset UTC2" + ts2_split[1] +
print("Fatal error 51: offset UTC1 " + ts1_split[1] +
" does not match offset UTC2 " + ts2_split[1] +
"\nProgram halted.")
print("Consider to standardize the 2 timestamps to Z (+00:00)")
print(" using <instance>.tz2utc(timestamp1)")
......@@ -132,12 +132,13 @@ class AaaaHorodatageTools(AaaaHorodatage):
self.ts2 = int(self.ts2 / 10000)
# test des epoch
if epoch1 != epoch2:
print("Fatal error 52: epoch1" + epoch1 +
" does not match epoch2" + epoch2 +
print("Fatal error 52: epoch1 " + str(epoch1) +
" does not match epoch2 " + str(epoch2) +
"\nProgram halted.")
print("Consider to standardize the 2 epochs")
print(" using <instance>.convert2epoch(timestamp1, epoch)")
print(" using <instance>.convert2epoch(timestamp2, epoch)")
sys.exit(52)
# ts2 > ts1 => sens diff = +, sinon -
self.sens_diff = "+"
if self.ts1 > self.ts2:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment