/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
util/system/compat.cpp
37 строк
647 B
qkrorlqr
Initial NBS OpenSource export
28 апр 2023, 21:54
28 апр 2023, 21:54
783a858
Код
Авторство
О чём код?
#include "compat.h" #include "progname.h" #include <util/generic/string.h> #ifdef _win_ #include "winint.h" #include <io.h> #endif #ifndef HAVE_NATIVE_GETPROGNAME const char* getprogname() { return GetProgramName().data(); } #endif #ifdef _win_ void sleep(i64 len) { Sleep((unsigned long)len * 1000); } void usleep(i64 len) { Sleep((unsigned long)len / 1000); } #include <fcntl.h> int ftruncate(int fd, i64 length) { return _chsize_s(fd, length); } int truncate(const char* name, i64 length) { int fd = ::_open(name, _O_WRONLY); int ret = ftruncate(fd, length); ::close(fd); return ret; } #endif