/************************************************************************* 【文件名】 CtiProjectInc.h 【功能模块和目的】 公共类型定义头文件 【开发者及日期】 郑石诺 2015/01/04 【版本】 V1.0.0 【版权信息】 Copyright (C)2014 河南华谊网络科技有限公司 【更改记录】 *************************************************************************/ #pragma once #define SINGLETON_DECLARE(classname) \ public: \ static classname& GetInstance(); #define SINGLETON_IMPLEMENT(classname) \ classname& classname::GetInstance() \ { \ static classname instance; \ return instance; \ } typedef void* PARAM; #define RELEASE(x) {if(x != NULL ){delete x;x=NULL;}} #define SC_LISTEN_PORT 8801 #define CTI_LISTEN_PORT 8811 #define ACD_LISTEN_PORT 8821 ////////////////////// golbal function declaration //////////////////////// /***************************************************************** **【函数名称】 FormatTime **【函数功能】 将time_t格式的时间值转换为"yyyy-mm-dd 00:00:00"格式 的时间字符串并返回 **【参数】 time 基础时间值(time_t) **【返回值】 时间字符串 *****************************************************************/ static CString FormatTime(time_t time); ////////////////////// golbal function definetion //////////////////////// CString FormatTime(time_t time) { // 定义初始值为"(NULL)",是因为数据库datetime字段只接受 (NULL) 格式的空值 CString strTime = _T("(NULL)"); if (time == 0) return strTime; // 时间格式转换处理 time_t -> tm -> szTime CHAR szTime[64]; memset(szTime, 0, sizeof(szTime)); tm local_time; localtime_s(&local_time, &time); strftime(szTime, sizeof(szTime), "\'%Y-%m-%d %H:%M:%S\'", &local_time); strTime.Format(_T("%s"), szTime); return strTime; }