k-time-kit


Namek-time-kit JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryA library to represents and easily manipulate duration in the format %y %d %h %m %s
upload_time2024-02-15 18:27:31
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License
keywords date duration format time timekit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # K-Time-Kit ⏱️

This project is a Python implementation of the Duration class, which represents a duration of time in years, days, hours, minutes, and seconds. It allows you to easily manipulate durations of time with arithmetic operations, conversions, and comparisons.

## Features 💡

* The Duration class can accept floating-point values for its parameters, and convert them to a standard time format.
* The Duration class can be added, subtracted, and compared to other durations with the operators `+`, `-`, `==`, `<=`, and `<`.
* The Duration class can be converted to seconds, minutes, hours, days, or years with the methods `to_sec`, `to_min`, `to_hour`, `to_day`, and `to_year`.
* The DurationInt class is an integer version of the Duration class, which allows you to manipulate large integers more efficiently.

## Examples of use 📝

```python
# Create a duration of 3 years, 2 days, 4 hours, 30 minutes, and 15 seconds
d1 = Duration(15, 30, 4, 2, 3)
print(d1) # prints "3.0y 2.0d 4.0h 30.0m 15.0s"

# Create a duration of 0.5 year, 0.25 day, 0.125 hour, 0.0625 minute, and 0.03125 second
d2 = Duration(0.03125, 0.0625, 0.125, 0.25, 0.5)
print(d2) # prints "0.0y 182.0d 18.0h 7.0m 33.78125s"

# Add two durations
d3 = d1 + d2
print(d3) # prints "3.0y 184.0d 22.0h 37.0m 48.78125s"

# Subtract two durations
d4 = d3 - d1
print(d4) # prints "0.0y 182.0d 18.0h 7.0m 33.78125s"

# Compare two durations
print(d1 == d2) # prints "False"
print(d1 <= d2) # prints "False"
print(d1 < d2) # prints "False"

# Convert a duration to seconds
print(d1.to_sec()) # prints "94770115.0"

# Convert a duration to minutes
print(d1.to_min()) # prints "1579950.25"

# Convert a duration to hours
print(d1.to_hour()) # prints "26332.504166666666"

# Convert a duration to days
print(d1.to_day()) # prints "1097.1876736111112"

# Convert a duration to years
print(d1.to_year()) # prints "3.0059936263318114"

# Create an integer duration of 1000000000 seconds
d5 = DurationInt(1000000000)
print(d5) # prints "31y 259d 1h 46m 40s"
```

## Author ✍️

This project was created by KpihX. You can contact me at kapoivha@gmail.com for any questions or suggestions.

## License 📄

This project is licensed under the MIT license - see the LICENSE file for more details.

: https://github.com/KpihX

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "k-time-kit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "KpihX <kapoivha@gmail.com>",
    "keywords": "date,duration,format,time,timekit",
    "author": "",
    "author_email": "KpihX <kapoivha@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/5f/23/c7ec72930f9411c1eb0954fe4e35c445b4baeb6ea03e88cab274fff44159/k_time_kit-0.0.2.tar.gz",
    "platform": null,
    "description": "# K-Time-Kit \u23f1\ufe0f\n\nThis project is a Python implementation of the Duration class, which represents a duration of time in years, days, hours, minutes, and seconds. It allows you to easily manipulate durations of time with arithmetic operations, conversions, and comparisons.\n\n## Features \ud83d\udca1\n\n* The Duration class can accept floating-point values for its parameters, and convert them to a standard time format.\n* The Duration class can be added, subtracted, and compared to other durations with the operators `+`, `-`, `==`, `<=`, and `<`.\n* The Duration class can be converted to seconds, minutes, hours, days, or years with the methods `to_sec`, `to_min`, `to_hour`, `to_day`, and `to_year`.\n* The DurationInt class is an integer version of the Duration class, which allows you to manipulate large integers more efficiently.\n\n## Examples of use \ud83d\udcdd\n\n```python\n# Create a duration of 3 years, 2 days, 4 hours, 30 minutes, and 15 seconds\nd1 = Duration(15, 30, 4, 2, 3)\nprint(d1) # prints \"3.0y 2.0d 4.0h 30.0m 15.0s\"\n\n# Create a duration of 0.5 year, 0.25 day, 0.125 hour, 0.0625 minute, and 0.03125 second\nd2 = Duration(0.03125, 0.0625, 0.125, 0.25, 0.5)\nprint(d2) # prints \"0.0y 182.0d 18.0h 7.0m 33.78125s\"\n\n# Add two durations\nd3 = d1 + d2\nprint(d3) # prints \"3.0y 184.0d 22.0h 37.0m 48.78125s\"\n\n# Subtract two durations\nd4 = d3 - d1\nprint(d4) # prints \"0.0y 182.0d 18.0h 7.0m 33.78125s\"\n\n# Compare two durations\nprint(d1 == d2) # prints \"False\"\nprint(d1 <= d2) # prints \"False\"\nprint(d1 < d2) # prints \"False\"\n\n# Convert a duration to seconds\nprint(d1.to_sec()) # prints \"94770115.0\"\n\n# Convert a duration to minutes\nprint(d1.to_min()) # prints \"1579950.25\"\n\n# Convert a duration to hours\nprint(d1.to_hour()) # prints \"26332.504166666666\"\n\n# Convert a duration to days\nprint(d1.to_day()) # prints \"1097.1876736111112\"\n\n# Convert a duration to years\nprint(d1.to_year()) # prints \"3.0059936263318114\"\n\n# Create an integer duration of 1000000000 seconds\nd5 = DurationInt(1000000000)\nprint(d5) # prints \"31y 259d 1h 46m 40s\"\n```\n\n## Author \u270d\ufe0f\n\nThis project was created by KpihX. You can contact me at kapoivha@gmail.com for any questions or suggestions.\n\n## License \ud83d\udcc4\n\nThis project is licensed under the MIT license - see the LICENSE file for more details.\n\n: https://github.com/KpihX\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A library to represents and easily manipulate duration in the format %y %d %h %m %s",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://pypi.org/project/k-time-kit/0.0.1/",
        "Issues": "https://github.com/KpihX/k_time_kit/issues",
        "Repository": "https://github.com/KpihX/k_time_kit.git"
    },
    "split_keywords": [
        "date",
        "duration",
        "format",
        "time",
        "timekit"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b07ec96c0c616aae82af62f8fa4a881000691ee52a752747494ddf1e36914f7e",
                "md5": "58a8f01e38a95eff82cafc5ddd640c3c",
                "sha256": "98ec86a0e5f5dc16ce567a9082d644de17ec7e4f555085c898feba15e970c32e"
            },
            "downloads": -1,
            "filename": "k_time_kit-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "58a8f01e38a95eff82cafc5ddd640c3c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4394,
            "upload_time": "2024-02-15T18:27:29",
            "upload_time_iso_8601": "2024-02-15T18:27:29.108290Z",
            "url": "https://files.pythonhosted.org/packages/b0/7e/c96c0c616aae82af62f8fa4a881000691ee52a752747494ddf1e36914f7e/k_time_kit-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5f23c7ec72930f9411c1eb0954fe4e35c445b4baeb6ea03e88cab274fff44159",
                "md5": "fa0c65bcb3c7d4ab5cdb7553510dfb5d",
                "sha256": "6b5dc868c67d86e9cc2e98c04f30f0903c7bdc6865aa49b5b536649e9028ebf1"
            },
            "downloads": -1,
            "filename": "k_time_kit-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "fa0c65bcb3c7d4ab5cdb7553510dfb5d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3892,
            "upload_time": "2024-02-15T18:27:31",
            "upload_time_iso_8601": "2024-02-15T18:27:31.861612Z",
            "url": "https://files.pythonhosted.org/packages/5f/23/c7ec72930f9411c1eb0954fe4e35c445b4baeb6ea03e88cab274fff44159/k_time_kit-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-15 18:27:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KpihX",
    "github_project": "k_time_kit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "k-time-kit"
}
        
Elapsed time: 0.19030s