📄 os_divers.c
字号:
/*
* GPAC - MPEG-4 Systems C Development Kit
*
* Copyright (c) Jean Le Feuvre 2000-2003
* All rights reserved
*
* This file is part of GPAC / common tools sub-project
*
* GPAC is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* GPAC is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <gpac/m4_tools.h>
#ifndef M4_READ_ONLY
#error "WinCE version shall be read-only"
#endif
void CE_Assert(u32 valid)
{
if (!valid) {
MessageBox(NULL, _T("ASSERT FAILED"), _T("Fatal Error"), MB_OK);
}
}
u32 CE_TimeGetTime()
{
return GetTickCount();
}
/*
Conversion code for WinCE from pthreads WinCE
(FILETIME in Win32 is from jan 1, 1601)
time between jan 1, 1601 and jan 1, 1970 in units of 100 nanoseconds
*/
#define TIMESPEC_TO_FILETIME_OFFSET (((LONGLONG)27111902 << 32) + (LONGLONG)3577643008)
int ce_gettimeofday(struct timeval *tp, void *tz)
{
FILETIME ft;
SYSTEMTIME st;
s32 val;
GetSystemTime(&st);
SystemTimeToFileTime(&st, &ft);
val = (s32) ((*(LONGLONG *) &ft - TIMESPEC_TO_FILETIME_OFFSET) / 10000000);
tp->tv_sec = (u32) val;
val = (s32 ) ((*(LONGLONG *) &ft - TIMESPEC_TO_FILETIME_OFFSET - ((LONGLONG) val * (LONGLONG) 10000000)) * 100);
tp->tv_usec = val;
return 0;
}
void M4_GetUTCTimeSince1970(u32 *sec, u32 *msec)
{
struct timeval tv;
ce_gettimeofday(&tv, NULL);
*sec = tv.tv_sec;
*msec = tv.tv_usec/1000;
}
void CE_WideToChar(unsigned short *w_str, char *str)
{
WideCharToMultiByte(CP_ACP, 0, w_str, -1, str, MAX_FILE_PATH, NULL, NULL);
}
void CE_CharToWide(char *str, unsigned short *w_str)
{
MultiByteToWideChar(CP_ACP, 0, str, -1, w_str, MAX_FILE_PATH);
}
//we assume we cannot have >4G files on winCE
Bool M4IsLargeFile(char *path)
{
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -