Commit 20fd195
committed
Refactor: Move timestamp function to shared helpers (DRY cleanup)
ISSUE:
- get_local_timestamp() was defined in main script
- Function was not reusable by other scripts
- Violated DRY principles (duplication risk)
ROOT CAUSE:
- Function was created before common-helpers.sh existed
- Never migrated to shared library
FIX:
- Added timestamp_local() to dist/bin/lib/common-helpers.sh
- Replaced 2 calls to get_local_timestamp() with timestamp_local()
* Line 414: Log header timestamp
* Line 463: Log footer timestamp
- Deleted duplicate function definition from main script (line 234-236)
IMPACT:
- Timestamp function now reusable across all scripts
- Follows DRY principles (single source of truth)
- Future scripts can use timestamp_local() without duplication
- Zero functional changes (output format unchanged)
TESTING:
- Ran script and verified log timestamps still work correctly
- Format: 2025-12-31 11:32:06 PST ✓
- Appears in both log header and footer ✓
RELATED:
- Part of DRY cleanup initiative (Phase 2)
- Complements Phase 1 version drift fix1 parent 8882d95 commit 20fd195
3 files changed
Lines changed: 19 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | 234 | | |
239 | 235 | | |
240 | 236 | | |
| |||
411 | 407 | | |
412 | 408 | | |
413 | 409 | | |
414 | | - | |
| 410 | + | |
415 | 411 | | |
416 | 412 | | |
417 | 413 | | |
| |||
460 | 456 | | |
461 | 457 | | |
462 | 458 | | |
463 | | - | |
| 459 | + | |
464 | 460 | | |
465 | 461 | | |
466 | 462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments