C++ 获取凌晨/月初 时间戳



static unsigned long long getMonthTime() {
        time_t t = time(0);   // get time now
        struct tm * zeroTm= localtime(&t);
        zeroTm->tm_hour = 0;
        zeroTm->tm_min = 0;
        zeroTm->tm_sec = 0;
        zeroTm->tm_mday = 0;
        unsigned long long zeroTime = mktime(zeroTm);
        return zeroTime*1000;
    }
    
    static unsigned long long getMorningTime() {

        time_t t = time(0);   // get time now
        struct tm * zeroTm= localtime(&t);
        zeroTm->tm_hour = 0;
        zeroTm->tm_min = 0;
        zeroTm->tm_sec = 0;
        unsigned long long zeroTime = mktime(zeroTm);
        return zeroTime*1000;
    }


你可能感兴趣的:(C/C++)