// DragonX Wallet - ImGui Edition // Copyright 2024-2026 The Hush Developers // Released under the GPLv3 // // Small shared text helpers used across the immediate-mode UI. Centralised here so the per-frame // hot paths use one allocation-free implementation instead of several copies. #pragma once #include #include #include namespace dragonx { namespace util { // Localized relative time, e.g. "5 minutes ago" (via i18n). Empty when timestamp <= 0. std::string formatTimeAgo(std::int64_t timestamp); // Compact, non-localized relative time for tight UI: "5s ago" / "3m ago" / "2h ago" / "4d ago". std::string formatTimeAgoShort(std::int64_t timestamp); // Case-insensitive substring test that does NOT allocate (unlike lower-casing copies + find). // An empty needle matches everything. Safe for per-frame filtering of large lists. bool containsIgnoreCase(std::string_view haystack, std::string_view needle); } // namespace util } // namespace dragonx