Skip to content

Add time_tools example (now, to_seconds, add_seconds)#638

Open
NA-V10 wants to merge 3 commits into
google:masterfrom
NA-V10:add-time-tools-example
Open

Add time_tools example (now, to_seconds, add_seconds)#638
NA-V10 wants to merge 3 commits into
google:masterfrom
NA-V10:add-time-tools-example

Conversation

@NA-V10

@NA-V10 NA-V10 commented Nov 23, 2025

Copy link
Copy Markdown

Summary

This PR adds a new example module time_tools to the examples/ directory.
It follows the same format and structure as the existing Google examples such as
cipher, including licensing headers, function layout, Fire usage style, and
test patterns.

Details

  • New folder: examples/time_tools/
  • Provides simple time utility functions:
    • now() — returns the current datetime string
    • to_seconds(minutes, seconds) — converts to total seconds
    • add_seconds(time_string, seconds) — adds seconds to a datetime
  • Fire CLI is invoked without a target component, so all module functions
    become CLI commands, consistent with other examples.
  • Includes a full test suite built using testutils.BaseTestCase.

Checklist

  • Example follows Google style (license header, naming, docstrings)
  • Test file included following Google's cipher_test.py pattern
  • No modifications to core Fire library
  • CLA signed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant