Skip to content

[210_12] feat(srfi-19): 初始化 time 和 date 结构,实现部分函数#396

Merged
jackmath5261-bit merged 15 commits intomainfrom
jinser/srfi-19-init
Feb 9, 2026
Merged

[210_12] feat(srfi-19): 初始化 time 和 date 结构,实现部分函数#396
jackmath5261-bit merged 15 commits intomainfrom
jinser/srfi-19-init

Conversation

@jetjinser
Copy link
Collaborator

@jetjinser jetjinser commented Jan 30, 2026

[210_12] (srfi srfi-19)

任务相关的代码文件

  • src/goldfish.hpp
  • tests/goldfish/liii/time-test.scm
  • goldfish/scheme/time.scm
  • goldfish/srfi/srfi-19.scm

如何测试

# 可能需要清除缓存
# rm .xmake/ build/ -r
xmake f -vyD
xmake b goldfish
./bin/goldfish tests/goldfish/liii/time-test.scm

2026/1/30 初始化 time 和 date 结构

What

  1. 新增 glue:g_gettimeofday, g_monotonic-nanosecond, g_steady-clock-resolution, g_system-clock-resolution
  2. 实现 time 与 date 基本结构
  3. 实现部分 SRFI-19 proc,包括 current-time, date->string

Why

扩充时间与日期的支持。

How

通过 C++17 的 chrono 绑定实现。

@jetjinser jetjinser marked this pull request as ready for review January 30, 2026 09:30
@jetjinser jetjinser changed the title [210_10] feat(srfi-19): 初始化 time 和 date 结构,实现部分函数 [210_11] feat(srfi-19): 初始化 time 和 date 结构,实现部分函数 Jan 30, 2026
@jetjinser jetjinser changed the title [210_11] feat(srfi-19): 初始化 time 和 date 结构,实现部分函数 [210_12] feat(srfi-19): 初始化 time 和 date 结构,实现部分函数 Jan 30, 2026
@jetjinser jetjinser force-pushed the jinser/srfi-19-init branch from d2ba472 to b0c90a4 Compare January 30, 2026 09:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements SRFI-19 time and date support for Goldfish Scheme by adding C++17 chrono-based glue functions and comprehensive Scheme implementations of time and date structures with formatting capabilities.

Changes:

  • Added C++ glue functions for time operations using std::chrono (get-time-of-day, monotonic-nanosecond, clock resolutions)
  • Implemented SRFI-19 time and date record types with accessors and basic operations
  • Implemented date-to-string formatting with extensive format specifier support
  • Added comprehensive test suite covering time/date creation, accessors, and formatting

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/goldfish.hpp Adds C++ glue functions using std::chrono for time operations and clock resolution queries
goldfish/scheme/time.scm Refactors current-second and current-jiffy to use new glue functions, exports clock resolution constants
goldfish/srfi/srfi-19.scm Implements SRFI-19 time/date types, current-time, time-resolution, date->string with format specifiers, and leap second handling
tests/goldfish/liii/time-test.scm Comprehensive test suite for time/date constants, constructors, accessors, formatting, and error conditions
devel/210_12.md Development documentation describing the implementation approach and testing instructions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jackmath5261-bit jackmath5261-bit merged commit 54cb162 into main Feb 9, 2026
4 checks passed
@jackmath5261-bit jackmath5261-bit deleted the jinser/srfi-19-init branch February 9, 2026 02:59
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.

2 participants