笔记学习:

linux系统gettime获取的时间.

int clock_gettime(clockid_t clk_id,struct timespec *tp);

//CLOCK_REALTIME:系统相对时间,从UTC 1970-1-1 0:0:0开始计时,更改系统时间会更改获取的值;

//CLOCK_MONOTONIC:系统绝对时间/单调时间,为系统重启到现在的时间,更改系统时间对它没有影响;

//CLOCK_PROCESS_CPUTIME_ID:本进程到当前代码系统CPU花费的时间;

//CLOCK_THREAD_CPUTIME_ID:本线程到当前代码系统CPU花费的时间;

struct timespec ts {};

(void)clock_gettime(CLOCK_MONOTONIC, &ts);

(ts.tv_sec*1000) + (ts.tv_nsec/1000000);

C++  去掉字符串中的空白:

 string.erase(std::remove_if(string.begin(), string.end(), [](unsigned char x){return std::isspace(x)};), string.end());

C++  字符串中分割:

std::vector<std::string> Splitstring(const std::string& in, const std::string& delim)
    {

        std::regex re{delim};
        std::vector<std::string>ret(
                std::sregex_token_iterator(in.begin(), in.end(), re, -1),
                std::sregex_token_iterator());
        return ret;
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值