{ "info": { "author": "Robert Sebille", "author_email": "robert@sebille.name", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# AaaaHorodatage\nThis program is under GNU General Public License, version 3, see LICENCE text file.\n\nThis program needs python 3 and modules aaaa.ahordat, aaaa.ahordattools.\n\n## AaaaHorodatage format\n[0-9]+AAAAZ+/-HH:MM where [0-9]+ = the number of seconds from the epoch until the date entered, AAAA = the epoch of the timestamp, and Z+/-HH:MM the UTC offset (e.g for CEST summertime: Z+02:00). The timezone and epoch are embedded.\n\n__Below, in the same directory as this README.md file__\n## Usage\n### In a file.py:\n from aaaa.ahordat import AaaaHorodatageTools\n \n### D\u00e9mo\nin python shel, eg:\n\n\tfrom aaaa.demo import demo\n\tdemo()\n### Init:\n\n from aaaa.ahordattools import AaaaHorodatageTools\n\n new_ts_object = AaaaHorodatageTools()\n or\n new_ts_object = AaaaHorodatageTools(AaaaTimestamp)\n or\n new_ts_object = AaaaHorodatageTools(\"server\")\n\n ... your code ...\n\nExemples:\n\n- _new_ts_object_ = _AaaaHorodatageTools()_ will create 2000Z+02:00 = 2000-01-01T00:00:00+02:00, embedded epoch = 2000, (Default).\n- _new_ts_object_ = _AaaaHorodatageTools(\"server\")_ will create ts_object with time server UTC.\n\n### Modifiers\nAn AaaaHordatage instance has one public instance attibutes: _self.ts_ (its timestamp). \n\nSome methods, i call modifiers, can change this attribute; they will be documented with _update self.ts_.\n\n### Generate timestamps\n\n encode(d=\"\", utc=False) # possible inputs:\n update and return self.ts\n d=\"\": keyboard input\n d= list, tuple or dictionary.\n utc=False: Local UTC offset encoding (see \"Setting your timezone\")\n utc=True: UTC encoding\n\n decode(\"typ\", ts=\"\") \n return typ = \"string\", \"list\", \"dict\" ou \"dictionary\"\n ts = timestamp (e.g.: ts_object.get_ts()): use ts.\n ts = none or \"\": use self.ts.\n\nNB: encode year > 9999 with an epoch = 1000 can causes long calculations.\n\n### timestamps copy\nShallow copy, but it's enough, here.\n\n new_ts_object = ts_object.copy()\n\n### Harmonize epoch and UTC offset\nConvert ts_object_to_harmonize to same epoch and UTC offset than ts_object\n\n ts_object.set_ts_same_epoch_offset(ts_object_to_harmonize)\n ts_object_to_harmonize.ts is updated\n\n\n## Timezones\n### Setting your timezone\nYour local timezone is stored in _utc_local_offset_ class attribute\nDefault is +7200 seconds, that is to say +02:00; Europe/Brussels summertime\n_utc_local_offset_ range: -43200 >= _utc_seconds_ <= +50400
\nTimestamps embbed their own UTC offset, then this attribute is just for encoding timestamp. \n\nYou can use public methods to get or set it.\n\n get_utc_local_offset(typ=\"\") # instance method\n typ=\"\": default, seconds (integer); typ=\"string\": \"+/-HH:MM\"\n Return _utc_local_offset\n\n set_utc_local_offset(*offset) # class method\n work with encode(). Default +02:00\n -43200 >= *offset <= +50400 or '-12:00' >= *offset <= '+14:00'\n\nGet the embedded UTC offset (the UTC offset embedded in self.ts)\n\n get_utc_ts_offset(typ=\"\"):\n typ=\"\": default, seconds (integer); typ=\"string\": \"+/-HH:MM\" \n return the embedded UTC offset\n\n### Converting timezone\nYou can use methods to convert timestamp from utc to a specific timezone and from a specific timezone to utc.\n\n tz2utc()\n update and return self.ts\n\n utc2tz(*new_offset) \n update and return self.ts\n\n -43200 >= *new_offset <= +50400 or \n '-12:00' >= *new_offset <= '+14:00'. \n\n### Converting offset\nYou can use this utility methods to convert offset from seconds to string and from string to seconds.\n\n offset_seconds2string(offset_seconds) # -43200 >= *new_offset <= +50400\n offset_string2seconds(offset_string) # no control\n\n### Timezones sites\nSome timezones sites can help you to determine tour timezone.\n\n* [24timezones](https://24timezones.com/);\n* [Time.is](https://time.is/time_zones)\n* [Time_zone](https://en.wikipedia.org/wiki/Time_zone) on Wikipedia.\n\n## Epoch\nthe reference epoch of the AaaaHorodatage class stored in _epoch_ class attribute
\nDefault is 2000. Range: 1000 <= _epoch_ <= 9999.
\nThe epoch attribute is used for encoding timestamps only. For decoding, the script uses the embedded epoch. Timestamp epoch lesser than epoch class attribute are accepted on decoding.\n\n### Setting epoch\nYou can use this class methods to get or set it.\n\n get_epoch() \n set_epoch(num) # 1000 <= epoch <= 9999, return epoch\n\n### Converting epoch\nYou can change and adapt the embedded epoch of a timestamp.\n\n convert2epoch(epoch) \n update and return self.ts\n Convert an embedded epoch to an other. \n 1000 <= epoch <= 9999.\n\n## Operations\nOperations relate to timestamps of the same UTC offset and at the same epoch only.\n\n### diffDays\n_See « - operator » too_\n\n ts1_object.diffDays(typ=\"string\", ts2=0) \n return ts2 - self.ts1 in days, hours, minutes, seconds.\n Offset UTC timestamp 1 must match offset UTC timestamp 2 and epoch timestamp 1 must match epoch timestamp 2.\n Return typ =\n - \"seconds\": return the number of seconds.\n - \"string\": return a string (+/-DDTHH:MM:SS). Default.\n - \"list\": return a list (fixed order).\n fixed order: sens_difference, day, hour, minutes, seconds.\n - \"dict\" or \"dictionary\": return a dict (any order).\n ts2 = 0 or none: keyboard input.\n ts2 eg: ts2_object.get_ts()\n\nTips with _ts1_object.diffDays(typ=\"string\", ts2=0)_
\nI want diffDays between ts1_object, epoch 2000 and offset +02:00, and ts2_object, epoch 1900 and offset +08:00, but not update ts2_object.
\nConsider this tips:\n\n ts3_object = ts2_object.copy()\n ts1_object.set_ts_same_epoch_offset(ts_object3)\n diff_ts2_ts1 = ts1_object.diffDays(\"string\", ts3_object.get_ts())\n del ts3_object\n\n### + operator\n\n + operator: ts_object = ts_object + nb_seconds\n update self.ts and return ts_object + nb_seconds\n Add nb_seconds at timestamp\n Tips: \n - use dhms2second(d=0, h=0, m=0, s=0) utility method \n to convert days + hours + minutes + seconds in seconds\n - To add seconds to a new timestamp instance:\n new_ts_object = ts_object.copy()\n new_ts_object - nb_seconds\n\n### - operator\n\n - operator: new_ts = ts_object - *nb_seconds_or_ts_object\n if *nb_seconds_or_ts_object is a nb_seconds integer\n update self.ts and return ts_object - *nb_seconds\n self.ts seconds - seconds must be >= 0 (epoch-01-01)\n\n if *nb_seconds_or_ts_object is ts_object, call\n self.ts.diffDays(\"string\", *nb_seconds_or_ts_object.get_ts())\n self.ts is NOT updated. See diffDays() method above.\n\n Tips: \n - use dhms2second(d=0, h=0, m=0, s=0) utility method \n to convert days + hours + minutes + seconds in seconds\n - To add seconds to a new timestamp instance:\n new_ts_object = ts_object.copy()\n new_ts_object - seconds\n\n### Comparison operators\n\n\tts_object1 == ts_object2\n\tts_object1 != ts_object2\n\tts_object1 < ts_object2\n\tts_object1 <= ts_object2\n\tts_object1 > ts_object2\n\tts_object1 >= ts_object2\n\n### Conversion to and from Posix\n\n ts_object.convert_aaaa2posix(aaaa_ts)\n Return a Posix timestamp (UTC) from an Aaaa timestamp\n\n ts_object.convert_posix2aaaa(posix_ts):\n Return an Aaaa timestamp from a Posix timestamp\n update self.ts\n posix_ts will be considered at UTC time.\n\n## Help:\n import aaaa.ahordattools\n help(aaaa.ahordattools)\n\n## Short demo\n\n python3 main.py\n\n__You can find some thoughts about algorithms in this [pdf document](https://bit.ly/2seHHvU \"Horodatage\").__\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://framagit.org/zenjo/AaaaHorodatage/tree/master", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://framagit.org/zenjo/AaaaHorodatage", "keywords": "", "license": "GNU GPL", "maintainer": "Robert Sebille", "maintainer_email": "robert@sebille.name", "name": "aaaahorodatage", "package_url": "https://pypi.org/project/aaaahorodatage/", "platform": "", "project_url": "https://pypi.org/project/aaaahorodatage/", "project_urls": { "Download": "https://framagit.org/zenjo/AaaaHorodatage/tree/master", "Homepage": "https://framagit.org/zenjo/AaaaHorodatage" }, "release_url": "https://pypi.org/project/aaaahorodatage/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "Module python 3 de gestion d'horodatages. Chaque horodatage embarque son \u00e9poque de r\u00e9f\u00e9rence et son fuseau horaire. L'\u00e9poque de r\u00e9f\u00e9rence est configurable et peut \u00eatre diff\u00e9rente de l'\u00e9poque Unix (1970-01-01T00:00:00) .", "version": "0.0.1" }, "last_serial": 5225609, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "97742669e9b730962452f2d734779d07", "sha256": "1c7242f799f9ab11c5f08114378fb85c4d992aa0d3b57c0d63ae0e748f8b0c26" }, "downloads": -1, "filename": "aaaahorodatage-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "97742669e9b730962452f2d734779d07", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27423, "upload_time": "2019-05-04T13:31:49", "url": "https://files.pythonhosted.org/packages/a2/34/af007d9067a61afbb3e024439c5b11a950b84530b07318c835c1c790bb95/aaaahorodatage-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d9f74dc43c779283d7ed0f38938869d3", "sha256": "87d1d4dbfa537a1fd7d188eb55158d8d0e3ffc8014b21495253e072a63fe4cf9" }, "downloads": -1, "filename": "aaaahorodatage-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d9f74dc43c779283d7ed0f38938869d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16608, "upload_time": "2019-05-04T13:31:51", "url": "https://files.pythonhosted.org/packages/42/d7/3b93c0f51a5a9267f770d5722b66e0f993ada12613540efdcba110e57da5/aaaahorodatage-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "97742669e9b730962452f2d734779d07", "sha256": "1c7242f799f9ab11c5f08114378fb85c4d992aa0d3b57c0d63ae0e748f8b0c26" }, "downloads": -1, "filename": "aaaahorodatage-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "97742669e9b730962452f2d734779d07", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27423, "upload_time": "2019-05-04T13:31:49", "url": "https://files.pythonhosted.org/packages/a2/34/af007d9067a61afbb3e024439c5b11a950b84530b07318c835c1c790bb95/aaaahorodatage-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d9f74dc43c779283d7ed0f38938869d3", "sha256": "87d1d4dbfa537a1fd7d188eb55158d8d0e3ffc8014b21495253e072a63fe4cf9" }, "downloads": -1, "filename": "aaaahorodatage-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d9f74dc43c779283d7ed0f38938869d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16608, "upload_time": "2019-05-04T13:31:51", "url": "https://files.pythonhosted.org/packages/42/d7/3b93c0f51a5a9267f770d5722b66e0f993ada12613540efdcba110e57da5/aaaahorodatage-0.0.1.tar.gz" } ] }