emilk / emilk/loguru

Custom YYYY field

Open
#53 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
1.9k
Forks
280
Avg merge
7m
Merged PRs (30d)
4

Description

It will be awesome if the `1900 + time_info.tm_year` column can be hidden (via a customization option)
```c++
void write_date_time(char* buff, size_t buff_size)
{
auto now = system_clock::now();
long long ms_since_epoch = duration_cast(now.time_since_epoch()).count();
time_t sec_since_epoch = time_t(ms_since_epoch / 1000);
tm time_info;
localtime_r(&sec_since_epoch, &time_info);
snprintf(buff, buff_size, "%04d%02d%02d_%02d%02d%02d.%03lld",
1900 + time_info.tm_year, 1 + time_info.tm_mon, time_info.tm_mday,
time_info.tm_hour, time_info.tm_min, time_info.tm_sec, ms_since_epoch % 1000);
}
````

@jacobdufault

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.