Firebase : Send notification with REST API(common.c)
/*
Firebase : Send notification with REST API(common.c)
*/
#include
#include
#include
#include
/*- ------------------------------------------------ -*
*- Current date Get function
*- ------------------------------------------------ -*/
/*- ------------------------------------------------ -*
*- GetDate() : 현재 날짜를 YYYYMMDD형식으로하여 정수형으로 Return
*- Return 값 : 변환된 날짜(YYYYMMDD)
*- ------------------------------------------------ -*/
int GetDate()
{
time_t tt;
struct tm *ltime;
char ctime[8];
time(&tt);
ltime = localtime(&tt);
sprintf(ctime, "%04d%02d%02d", ltime->tm_year+1900, ltime->tm_mon+1, ltime->tm_mday);
return(atoi(ctime));
}
/*- ------------------------------------------------ -*
*- GetTime() : 현재 시간 값을 구하는 함수
*- Return 값 : 현재 시간 (HHMMSS)
*- ------------------------------------------------ -*/
int GetTime()
{
time_t tt;
struct tm *ltime;
char ctime[2];
time(&tt);
ltime = localtime(&tt);
sprintf(ctime, "%02d%02d%02d", ltime->tm_hour, ltime->tm_min, ltime->tm_sec);
return(atoi(ctime));
}