Skip to content

Add keybindings to insert Unix timestamp literals - #2272

Merged
rolandwalker merged 1 commit into
mainfrom
RW/timestamp-literal-keystrokes
Sep 26, 2026
Merged

rolandwalker merged 1 commit into
mainfrom
RW/timestamp-literal-keystrokes

Conversation

@rolandwalker

@rolandwalker rolandwalker commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add keybindings to insert Unix timestamp literals, by analogy to existing keybindings for inserting date/datetime literals.

  • C-o u: inserts the Unix timestamp in seconds
  • C-o C-u: inserts the Unix timestamp in microseconds

The timestamp is calculated clientside, rather than invoking UNIX_TIMESTAMP() on the server, under the theory that clocks are correctly synchronized. This could be revisited. It allows a nicer microsecond value.

Motivation: queries using UNIX_TIMESTAMP() are not repeatable.

Incidentally adds a noop keystroke test.

Checklist

  • I added this contribution to the changelog.md file.
  • I added my name to the AUTHORS file (or it's already there).
  • To lint and format the code, I ran
    uv run ruff check && uv run ruff format && uv run mypy --install-types .

@rolandwalker rolandwalker self-assigned this Sep 26, 2026
by analogy to existing keybindings for inserting date/datetime literals.

 * C-o u: inserts the Unix timestamp in seconds
 * C-o C-u: inserts the Unix timestamp in microseconds

The timestamp is calculated clientside, rather than invoking
UNIX_TIMESTAMP() on the server, under the theory that clocks are
correctly synchronized.  This could be revisited.  It allows a nicer
microsecond value.

Motivation: queries using UNIX_TIMESTAMP() are not repeatable.

Incidentally adds a noop keystroke test.
@rolandwalker
rolandwalker force-pushed the RW/timestamp-literal-keystrokes branch from d09b2e6 to 5030c6d Compare September 26, 2026 11:52
@rolandwalker rolandwalker changed the title Add keystrokes to insert Unix timestamp literals Add keybindings to insert Unix timestamp literals Sep 26, 2026
@rolandwalker
rolandwalker merged commit a6e7289 into main Sep 26, 2026
12 checks passed
@rolandwalker
rolandwalker deleted the RW/timestamp-literal-keystrokes branch September 26, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant