Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

ticktock-utils

Latest version: v1.5.0

Overview

Last scanned
27 Nov 2026
Published
27 Nov 2026
PyPI package Publisher: lhlh333
0 Stars
0 Forks
21 Versions
1.5K Downloads
Python Repo language

Scan summary

ticktock-utils was last scanned on 27 Nov 2026 at version 1.5.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 21 versions; the latest was published on 27 Nov 2026.
  • Findings: No rules fired in version 1.5.0.
  • Downloads: 1,526 downloads.

Versions

21 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.5.0 LATEST 27 Nov 2026 No rules fired
1.4.0 16 Nov 2026 No rules fired
1.3.0 8 Nov 2026 No rules fired
1.2.1 7 Nov 2026 Not shown
1.2.0 4 Nov 2026 Not shown

No rules fired in 1.5.0

Findings

Findings for v1.5.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 1.5.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

ticktock_utils

一个超级简单、轻量级的 Python 时间工具库。支持拿到当前时间、判断闰年、验证日期,还带贴心报错!

🚀 快速开始(Quick Start)

安装很简单:

pip install ticktock_utils

然后你就可以用了:

import ticktock_utils

# 拿到今天
year, month, day = ticktock_utils.get_ymd()
print(f"今天是 {year} 年 {month} 月 {day} 日")

# 拿到现在
hour, minute, second = ticktock_utils.get_hms()
print(f"现在是 {hour}:{minute}:{second}")

🧠 功能列表

功能 效果
语言检测 _detect_language() 依次查看 TICKTOCK_LANG 环境变量、LANG 和系统 locale,返回 True 表示英文、False 表示中文;这些都没有取到值时默认中文
全局语言开关 error_is_english / easter_egg_is_english 模块加载时只检测一次语言,把结果存成全局变量;后续报错文案和彩蛋文案都按它选择中英文
节日日期缓存 _get_festival_dates(year) 把春节、元宵、端午、七夕、中元、中秋、重阳、腊八这 8 个农历节日换算成当年的公历 (月, 日),结果由 lru_cache 缓存
异常类 TimeError / MonthError / DayError 三级自定义异常:月份不在 1–12 时抛出 MonthError,日期超出当月天数时抛出 DayError
传统节日判断 get_festival() 把今天转成农历后比对节日表;如果今天是腊月 29 日或 30 日、且次日为正月初一,就判为除夕;没有命中任何节日则返回“现在不是传统节日”
取年月日 get_ymd() 返回当前的 (年, 月, 日) 元组
取时分秒 get_hms() 返回当前的 (时, 分, 秒) 元组
取当前时间 get_now() 返回完整的 datetime 对象
闰年判断 is_leap_year(year) 按 4、100、400 三条规则返回 True 或 False
当月天数 get_days_in_month(year, month) 返回 28、29、30 或 31;月份不在 1–12 时按语言抛出 MonthError
日期格式化 format_date(fmt) 按指定格式输出当前日期,默认格式为 %Y-%m-%d,例如 2026-11-26
日期合法性校验 validate_date(y, m, d) 合法返回 True;月份或日期越界时按语言抛出对应异常
星期几 get_weekday() 返回 0–6,0 表示周一、6 表示周日
是否周末 is_weekend() 周六、周日返回 True
距周末天数 days_until_weekend() 按 (5 - 今天) % 7 计算,工作日返回距周六的天数,周六返回 0
当前时段 get_period_of_day() 按小时返回 早晨、上午、中午、下午、傍晚、深夜 六档之一
是否过去日期 is_past_date(str) 传入的 ISO 日期早于今天则返回 True
时间差 time_difference(start, end) 两个 ISO 时间相减,返回“X天X小时X分钟”,秒数被舍去
转时间戳 date_to_timestamp(str) 把 ISO 日期字符串转成整数型 Unix 时间戳
本月第几周 get_week_of_month() 1–28 号按 (日-1)//7+1 算出 1–4 周;29 号及以后直接返回“不在计算内”的提示
休息提醒 rest_reminder(interval, max_times) 循环休眠,每到时间点打印提醒并弹出 tkinter 消息框;默认每 20 分钟提醒一次、共 5 次
距整点 countdown_to_next_hour() 返回“距离下一个整点还有 X 分钟”
日期相差天数 days_between(d1, d2) 返回 d2−d1 的天数,结果可以为负
时长可读化 format_duration(seconds) 把秒数转成“1天2小时3分4秒”这样的文字,为 0 时返回“0秒”
同一天判断 is_same_day(d1, d2) 两个日期是同一天则返回 True
装哥语录 zhuangge_quote() 从中英文各 10 条语录中随机返回一条(彩蛋)
相对时间 time_ago(dt_str) 把过去的时间点转成“X秒前、分钟前、小时前、天前、个月前、年前”
日期倒计时 countdown_to_date(target) 目标在未来时返回“还有 X 天”,是当天时返回“就是今天”,已经过去时返回“已经过去 X 天”
季节判断 get_season(date_str) 按 3/20、6/21、9/23、12/21 分界,返回春、夏、秋、冬,默认取今天
同一周判断 is_same_week(d1, d2) 按 ISO 周(周一开始)比较,同年同周则返回 True
是否工作日 is_workday() 周一到周五返回 True
距工作日 days_until_workday() 工作日返回 0,周六返回 2,周日返回 1
本周起止 get_week_range(date_str) 返回所在周的周一和周日两个日期字符串
下个工作日 next_workday() 返回下一个工作日的 YYYY-MM-DD,如果今天就是工作日则返回今天
距指定星期 days_until_specific_weekday(n) 传入 0–6 后按 (目标-今天)%7 算出天数,越界抛出 ValueError
距月末 days_until_month_end() 返回距本月最后一天还有几天,最后一天返回 0
距年末 days_until_year_end() 返回距 12 月 31 日还有几天
距下个节日 days_until_next_festival() 只取今年和明年的节日日期,找出最近的一个并返回相隔天数;没有候选时返回 365
作者留言 secret_message() 打印作者留言,周末和工作日各有一套鼓励文案,署名“来自一位四年级的小程序员”
农历转公历 lunar_to_solar(y, m, d) 把农历日期换算成公历,返回 (年, 月, 日)
生肖 get_zodiac(year) 按 (year-4) % 12 返回鼠到猪中的一个生肖
干支常量表 TIANGAN / DIZHI / SHENGXIAO 10 个天干、12 个地支、12 个生肖三张固定表
干支 get_ganzhi(year) 返回两位干支字符串,例如“甲辰”
完整干支 get_ganzhi_full(year) 返回包含天干、地支、干支、生肖四项的字典
公历转农历 solar_to_lunar(y, m, d) 把公历日期换算成农历,返回 (年, 月, 日)
按日期算干支 get_ganzhi_from_date(date) 先把公历日期转成农历年,再返回该年的干支字典
节气表 SOLAR_TERMS / SOLAR_TERMS_DICT 24 节气按公历月排成固定表,另建 (月, 日) 到节气名的哈希表,用于 O(1) 查询
当日节气 get_solar_term(date) 直接查哈希表,当天是节气则返回名字,否则返回 None
下个节气 next_solar_term(date) 在今后两年节气中找最近的一个,返回 (节气名, 还有几天)
全部节气 get_solar_terms() 返回 24 个 (月, 日, 节气名) 元组
星座 get_zodiac_sign(date) 把月日拼成数值后用 bisect 二分定位,返回 12 星座之一
同月判断 is_same_month(d1, d2) 同年同月则返回 True
距下月 days_until_next_month() 返回距下月 1 号还有几天
博物馆彩蛋 fullstack_museum() 打印作者另一个作品的链接,并附一句“记得每天保持微笑”

⚠️ 报错处理

如果你输入了错误的月份或日期,报错也不会让你头大:

import ticktock_utils

try:
    ticktock_utils.validate_date(2026, 2, 29)  # 2026年是平年,28天
except ticktock_utils.MonthError:
    print("月份输入有误!")
except ticktock_utils.DayError:
    print("日期超出当月天数了!")

📜 License

MIT

📝 更新日志 (Changelog)

把文档补了一下

👉 点击这里查看完整的 CHANGELOG.md

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases ticktock-utils

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Frame 2085668439 (1)
Group 1261154229