Fixing Claude's Time Hallucinations in Claude Code with Hooks

A Reddit user identified and solved a specific issue with Claude Code where the AI assistant makes incorrect time-based suggestions due to lacking real-time clock access.
The Problem
Claude doesn't have access to a real-time clock. While it receives today's date at session start, it doesn't get the current time. This causes Claude to guess the time - often incorrectly - leading to inappropriate suggestions like "it's late, get some rest" when it's actually noon. This solution only works in Claude Code, not the web or desktop versions.
The Solution
The fix involves adding a single hook to Claude Code's settings file:
- Open or create ~/.claude/settings.json (or ask Claude Code to do it for you)
- Paste this configuration:
{
"hooks": {
"UserPromptSubmit": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "echo \"Current time: $(date '+%A %Y-%m-%d %I:%M %p %Z')\""
}
]
}
]
}
}The solution works immediately without requiring a restart.
How It Works
Every time you send a message, the hook runs the date command and injects the output into Claude's context behind the scenes. Users don't see this output - Claude sees something like "Current time: Monday 2026-04-06 03:39 AM EDT." Because the hook fires on every message, Claude can also detect when you've stepped away and returned by observing the time gap between messages.
This approach leverages Claude Code's hooks feature - shell commands that fire automatically on specific events like UserPromptSubmit.
📖 Read the full source: r/ClaudeAI
👀 See Also

Wtf.md and Dreaming: Two Claude Workflow Concepts Worth Exploring
A developer shares two Claude concepts: Wtf.md for storing errors Claude makes, and Dreaming, Karpathy's idea for nightly session consolidation.

How to Disable Claude Code's 1M Context Window to Reduce Token Usage
Anthropic users can disable the 1M context window in Claude Code by adding environment variables to settings.json, which may reduce unexpected token consumption. The source provides two configuration options: completely disabling 1M context or capping the auto-compact window.

iCloud Desktop/Documents Sync Causes File Loss Issues with Claude on Mac
A Mac user reports that enabling iCloud Drive sync for Desktop and Documents folders causes Claude to create duplicate files and can lead to permanent data loss, including hidden /.claude folders that iCloud doesn't back up.

5 Patterns for Getting Better Results from Claude (Non-Technical Users)
Practical scaffolding, example-based prompting, negative instructions, persistent context, and source grounding — five patterns that consistently improve output quality from Claude, backed by six months of field experience.