io_utils/time_utils
io_utils.h
#pragma once
#include<stdio.h>
#include<stdarg.h>
void PrintBinary(unsigned int value);
//#define PRINT_METADATA
#ifdef PRINT_METADATA
#define PRINTLNF(format,...) printf("("__FILE__":%d) %s: "format"\n",__LINE__,__FUNCTION__,##__VA_ARGS__)
#else
#define PRINTLNF(format,...)printf(format"\n",##__VA_ARGS__)
#endif
#define PRINT_CHAR(char_value) PRINTLNF(#char_value": %c",char_value)
#define PRINT_WCHAR(char_value)PRINTLNF(#char_value": %lc",char_value)
#define PRINT_INT(int_value)PRINTLNF(#int_value": %d",int_value)
#define PRINT_LONG(long_value)PRINTLNF(#long_value"%ld",long_value)
#define PRINT_LLONG(long_value)PRINTLNF(#long_value"%lld",long_value)
#define PRINT_BINARY(int_value)PrintBinary((unsigned int) int_value);
#define PRINT_HEX(int_value)PRINTLNF(#int_value": %#x",int_value)
#define PRINT_BOOL(bool_value)PRINTLNF(#bool_value": %s",bool_value?"true":"false")
#define PRINT_DOUBLE(double_value)PRINTLNF(#double_value": %g",double_value)
#define PRINT_STRING(string_value)PIRNTLNF(#string_value": %s",string_value)
#define PRINT_ARRAY(format,array,length)\
{\
for(int array_index = 0;array_index<length;++array_index)\
{\
printf(format,array[array_index]);\
}\
printf("\n");\
}
#define PRINT_INT_ARRAY_LN(array,length)\
{\
for(int i = 0;i<length;++i)\
{\
PRINTLNF(#array[i]"[%d]: %d",i,array[i]);\
}\
}
#define PRINT_INT_ARRAY(array,length)PRINT_ARRAY("%d",array,length)
#define PRINT_CHAR_ARRAY(array,length)PRINT_ARRAY("%c",array,length)
#define PRINT_DOUBLE_ARRAY(array,length)PRINT_ARRAY("%g",array,length)
time_utils.h
#pragma once
#if defined(_WIN32)
#include<sys/timeb.h>
#if defined(__UNIX__)||defined(__APPLE__)
#include<time.h>
#endif
typedef long long long_time_t;
long_time_t TimeInMillisecond(void) {
#if defined(_WIN32)
struct timeb time_buffer;
ftime(&time_buffer);
return time_buffer.time*1000LL+time_buffer.millitm;
#elif defined(__UNIX__)||defined(__APPLE__)
struct timeval time_value;
gettimeofday(&time_buffer,NULL);
return time_buffer.tv_sec*1000LL+time_buffer.tv_usec/1000;
#elif defined(__STDC__)&&__STDC__VERSION__==201112L
struct timespec timespec_value;
timespec_get(×pec_value,TIME_UTC);
return timespec_value.tv_sec*1000LL+timespec_value.tv_nsec/1000;
#else
time_t current_time = time(NULL);
return current_time*1000LL;
#endif
}
#endif
```
io_utils/time_utils的更多相关文章
- OSG动画学习
OSG动画学习 转自:http://bbs.osgchina.org/forum.php?mod=viewthread&tid=3899&_dsign=2587a6a9 学习动画,看了 ...
- OSG 自定义数据类型 关键帧动画
OSG 自定义数据类型 关键帧动画 转自:http://blog.csdn.net/zhuyingqingfen/article/details/12651017 /* 1.创建一个AnimManag ...
- OSG事件回调
OSG中的节点主要使用回调(CallBack)来完成用户临时.需要每帧执行的工作.根据回调功能被调用的时机划分为更新回调(Update CallBack)和人机交互时间回调(Event CallBac ...
- Python模块——PrettyTable 模块
简介 PrettyTable 是python中的一个第三方库,可用来生成美观的ASCII格式的表格,十分实用. 安装 pip install prettytable 示例 从已有文件创建 CSV fr ...
- python ftplib模块使用
Python中默认安装的ftplib模块定义了FTP类,可用来实现简单的ftp客户端,用于上传或下载文件. ftplib模块常用方法 ftp登陆连接 from ftplib import FTP #加 ...
- python批量拷贝文件
普通批量拷贝文件 import os import shutil import logging from logging import handlers from colorama import Fo ...
- Keras 源码分析
. │ activations.py │ callbacks.py │ constraints.py │ initializations.py │ metrics.py │ models.py │ o ...
- ValueError: Cannot create group in read only mode.
报错 Using TensorFlow backend. Traceback (most recent call last): File "D:/PyCharm 5.0.3/WorkSpac ...
- osg编译日志-release
1>------ 已启动生成: 项目: ZERO_CHECK, 配置: Release x64 ------1> Checking Build System1> CMake does ...
- osgViewer
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source ...
随机推荐
- 矩池云教程|体验 OpenAI 最近推出的 3D 生成模型 Shap-E!
Shap-E 是由 OpenAI 最近推出的3D生成模型,使用者可以通过简单的文字或图像进行三维模型的生成,OpenAI 认为相比于点云的生成模型Point-E,Shap-E的收敛更快.本文将展示如何 ...
- 矩池云产品最新动态 All in One
AI/ML 的不断革新,让我们看到了更多激动人心的应用方向,也迸发了更多的训练&应用场景. 在用户的反馈和建议下,矩池云持续丰富和优化在 AI+Science 链路上的相关产品,为了帮助研究人 ...
- 【Azure 环境】使用az login登录遇见OSError: [WinError -2146893813] : '' 错误
问题描述 使用 az login指令登录,遇见 OS Error: [WinError -2146893813] : '', 在指令中添加 --debug后,输出的错误消息为: urllib3.con ...
- 【Azure 应用服务】App Service 配置 Application Settings 访问Storage Account得到 could not be resolved: '*.file.core.windows.net'的报错。没有解析成对应中国区 Storage Account地址 *.file.core.chinacloudapi.cn
问题描述 App Service 配置 Application Settings 访问Storage Account.如下: { "name": "WEBSITE_CON ...
- C++11的类型转换
//C类型转换 /* C语言:显式和隐式类型转换 隐式类型转化:编译器在编译阶段自动进行,能转就转,不能转就编译失败 显式类型转化:需要用户自己处理. 隐式类型:界定:相关类型,相近类型,意义相似的类 ...
- CentOS 设置系统时间与网络时间同步
CentOS 设置系统时间与网络时间同步 一.Linux的时间分为(两种) System Clock(系统时间) 指当前Linux Kernel中的时间 Real Time Clock (硬件时间,简 ...
- Java 在三个数字中找出最大值
1 int aa1 = 11000000; 2 int aa2 = 20000; 3 int aa3 = 6000; 4 5 //第一种 6 int max = (aa1 > aa2)? aa1 ...
- gRPC入门学习之旅(一)
gRpc简介 gRPC 是Google公司开发的基于HTTP/2设计,面向移动的一个高性能.开源和通用的 RPC 框架,是一款语言中立.平台中立.开源的远程过程调用(RPC)系统. gRpc官网地址: ...
- Abp.Zero 手机号免密登录验证与号码绑定功能的实现(二):改造Abp默认实现
接下来我们重写原Abp的部分实现,来驳接手机号相关业务. 改造User类 重写PhoneNumber使得电话号码为必填项,和中国大陆手机号11位长度 public new const int MaxP ...
- Zabbix6.0使用教程 (二)—zabbix6.0常用术语
上一次我们已经详细介绍了zabbix6.0的新增功能,本篇我们来说说zabbix6.0常用的一些术语,这个对小伙伴日常使用zabbix的时候还是非常有用,建议大家收藏起来,话不多说,附上干货. 概览 ...