aboutsummaryrefslogtreecommitdiffstats
path: root/util/datetime
diff options
context:
space:
mode:
authorsomov <somov@yandex-team.com>2024-01-31 21:31:25 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-02-09 19:16:43 +0300
commit446f5cacb5bbd03b89fda98b7c8ea9856b3e8167 (patch)
treed7e024a47c516d45fa4526cb618c252ed65eebbf /util/datetime
parenta8317524cd814ecc3d9f3e03f92397a2492d1d3e (diff)
downloadydb-446f5cacb5bbd03b89fda98b7c8ea9856b3e8167.tar.gz
Fix sprintf deprecation warnings on newer macOS SDK
Diffstat (limited to 'util/datetime')
-rw-r--r--util/datetime/base.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/datetime/base.cpp b/util/datetime/base.cpp
index 9b4ec5234b..83a17660fd 100644
--- a/util/datetime/base.cpp
+++ b/util/datetime/base.cpp
@@ -258,7 +258,7 @@ void sprint_gm_date(char* buf, time_t when, long* sec) {
void DateToString(char* buf, const struct tm& theTm) {
Y_ENSURE(0 <= theTm.tm_year + 1900 && theTm.tm_year + 1900 <= 9999, "invalid year " + ToString(theTm.tm_year + 1900) + ", year should be in range [0, 9999]");
- sprintf(buf, "%04d%02d%02d", theTm.tm_year + 1900, theTm.tm_mon + 1, theTm.tm_mday);
+ snprintf(buf, DATE_BUF_LEN, "%04d%02d%02d", theTm.tm_year + 1900, theTm.tm_mon + 1, theTm.tm_mday);
}
void DateToString(char* buf, time_t when, long* sec) {
@@ -287,7 +287,7 @@ TString DateToString(time_t when, long* sec) {
TString YearToString(const struct tm& theTm) {
Y_ENSURE(0 <= theTm.tm_year + 1900 && theTm.tm_year + 1900 <= 9999, "invalid year " + ToString(theTm.tm_year + 1900) + ", year should be in range [0, 9999]");
char buf[16];
- sprintf(buf, "%04d", theTm.tm_year + 1900);
+ snprintf(buf, 16, "%04d", theTm.tm_year + 1900);
return buf;
}