Skip to content

get_current_time_tostring参数问题 #1

Description

@JMechan

get_current_time_tostring(bool is_repeat = true)
参数默认是true,这个参数是否需要
1、如果需要,这个参数改成false,调用format时,如果两次调用时间一样,get_current_time_tostring 返回std::nullopt,无异常处理,会导致挂死。
而且is_repeat为false时,两次调用时间一样时,返回一个缓存的str,而不是std::nullopt,std::nullopt作为异常情况时的返回,这样是不是更合理一点?
2、如果参数不能更改,就不应该设置参数。代码逻辑和异常处理需要优化一下。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions