当前位置: 首页>>代码示例>>C++>>正文


C++ date2days函数代码示例

本文整理汇总了C++中date2days函数的典型用法代码示例。如果您正苦于以下问题:C++ date2days函数的具体用法?C++ date2days怎么用?C++ date2days使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了date2days函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: date2days

uint16_t DS3231::dayInYear(uint16_t year, uint8_t month, uint8_t day)
{
    uint16_t fromDate;
    uint16_t toDate;

    fromDate = date2days(year, 1, 1);
    toDate = date2days(year, month, day);

    return (toDate - fromDate);
}
开发者ID:AmmarkoV,项目名称:AmmarServer,代码行数:10,代码来源:DS3231.cpp

示例2: date2days

uint32_t DateTime::unixtime(void) const {
  uint32_t t;
  uint16_t days = date2days(yOff, m, d);
  t = time2long(days, hh, mm, ss);
  t += SECONDS_FROM_1970_TO_2000;  // seconds from 1970 to 2000
  return t;
}
开发者ID:svcabre,项目名称:wordclock,代码行数:7,代码来源:Chronodot.cpp

示例3: read_unix_time

uint32_t read_unix_time()
{
	DS1307 time;
	read_ds1307(&time); 
	uint32_t unixtime = time2long(date2days(time.year, time.month, time.day), time.hour, time.minute, time.second);
	return unixtime + SECONDS_FROM_1970_TO_2000;
}
开发者ID:joelluijmes,项目名称:druppel-avr,代码行数:7,代码来源:ds1307.c

示例4: date2days

uint32_t DateTime::secondstime( void ) const
{
  uint32_t t;
  uint16_t days = date2days( yOff, m, d );
  
  t = time2long( days, hh, mm, ss );
  return t;
}
开发者ID:Hotboards,项目名称:Hotboards_rtcc,代码行数:8,代码来源:Hotboards_rtcc.cpp

示例5: date2days

uint32_t DateTime::unixtime(void) const {
  uint32_t t;
  uint16_t days = date2days(year_, month_, day_);
  t = time2long(days, hour_, minute_, second_);
  t += SECONDS_FROM_1970_TO_2000;

  return t;
}
开发者ID:sigorilla,项目名称:arduino-ntp-server,代码行数:8,代码来源:DateTime.cpp

示例6: date2days

uint32_t DateTime::unixtime(void) const {
  uint32_t t;
  uint16_t days = date2days(Year, Month, Day);
  t = time2long(days, Hour, Minute, Second);
  t += SECONDS_FROM_1970_TO_2000;  // seconds from 1970 to 2000

  return t;
}
开发者ID:edsw,项目名称:DS3231_Simple,代码行数:8,代码来源:DateTime.cpp

示例7: time2long

uint32_t DS3231::unixtime(void)
{
    uint32_t u;

    u = time2long(date2days(t.year, t.month, t.day), t.hour, t.minute, t.second);
    u += 946681200;

    return u;
}
开发者ID:AmmarkoV,项目名称:AmmarServer,代码行数:9,代码来源:DS3231.cpp

示例8: date2millis

w_millis date2millis(w_date date) {

  w_int days = date2days(date);
  w_millis millis;
 
  millis = (w_millis)(days * MSECS_PER_DAY);
  millis += date->msec;
 
  /*
  **  we started the day so we delete those milliseconds ...
  */
  millis -= (w_millis)MSECS_PER_DAY;

  return millis;
 
}
开发者ID:caizongchao,项目名称:open-mika,代码行数:16,代码来源:dates.c

示例9: switch


//.........这里部分代码省略.........
	case EVAL_FUNCTION_LOG:
		if( argc == 1 ) { * pValue = log(argv[0]); return TRUE; }
		break;

	case EVAL_FUNCTION_LOG10:
		if( argc == 1 ) { * pValue = log10(argv[0]); return TRUE; }
		break;

	case EVAL_FUNCTION_POW:
		if( argc == 2 ) { * pValue = pow(argv[0], argv[1]); return TRUE; }
		break;

	case EVAL_FUNCTION_SQR:
		if( argc == 1 ) { * pValue = argv[0] * argv[0]; return TRUE; }
		break;

	case EVAL_FUNCTION_SQRT:
		if( argc == 1 ) { * pValue = sqrt(argv[0]); return TRUE; }
		break;

	case EVAL_FUNCTION_TODAY:
		if( argc == 0 ) { * pValue = (double)today(); return TRUE; }
		break;

	case EVAL_FUNCTION_YEARDAYS:
		if( argc == 1 ) { * pValue = (double)yeardays((int)argv[0]); return TRUE; }
		break;

	case EVAL_FUNCTION_MONTHDAYS:
		if( argc == 2 ) { * pValue = (double)monthdays((int)argv[0], (int)argv[1]); return TRUE; }
		break;

	case EVAL_FUNCTION_DATE2DAYS:
		if( argc == 1 ) { * pValue = (double)date2days((int)argv[0]); return TRUE; }
		break;

	case EVAL_FUNCTION_DAYS2DATE:
		if( argc == 1 ) { * pValue = (double)days2date((int)argv[0]); return TRUE; }
		break;

	case EVAL_FUNCTION_EOMDAY:
		if( argc == 2 ) { * pValue = (double)eomday((int)argv[0], (int)argv[1]); return TRUE; }
		break;

	case EVAL_FUNCTION_EOMDATE:
		if( argc == 2 ) { * pValue = (double)eomdate((int)argv[0], (int)argv[1]); return TRUE; }
		break;

	case EVAL_FUNCTION_WEEKDAY:
		if( argc == 1 ) { * pValue = (double)weekday((int)argv[0]); return TRUE; }
		break;

	case EVAL_FUNCTION_ISBIZDATE:
		if( argc == 1 ) { * pValue = (double)isbizdate((int)argv[0], HDC_SUNSAT  ); return TRUE; }
		if( argc == 2 ) { * pValue = (double)isbizdate((int)argv[0], (int)argv[1]); return TRUE; }
		break;

	case EVAL_FUNCTION_NBIZDATE:
		if( argc == 1 ) { * pValue = (double)nbizdate((int)argv[0], HDC_SUNSAT  ); return TRUE; }
		if( argc == 2 ) { * pValue = (double)nbizdate((int)argv[0], (int)argv[1]); return TRUE; }
		break;

	case EVAL_FUNCTION_PBIZDATE:
		if( argc == 1 ) { * pValue = (double)pbizdate((int)argv[0], HDC_SUNSAT  ); return TRUE; }
		if( argc == 2 ) { * pValue = (double)pbizdate((int)argv[0], (int)argv[1]); return TRUE; }
		break;
开发者ID:apex-hughin,项目名称:CrimsonEditor,代码行数:67,代码来源:evaluate.cpp

示例10: date2days

uint8_t DateTime::dayOfWeek() const {
    uint16_t day = date2days(yOff, m, d);
    return (day + 6) % 7; // Jan 1, 2000 is a Saturday, i.e. returns 6
}
开发者ID:ASHOK1991,项目名称:lb-Arduino-Code,代码行数:4,代码来源:RTClib.cpp

示例11: return

uint8_t DateTime::dayOfWeek() const {    
  return (date2days(yOff, m, d) + 6) % 7; // Jan 1, 2000 is a Sat, returns 6
}
开发者ID:JayMcGee,项目名称:GameFrame,代码行数:3,代码来源:RTClite.cpp

示例12: time2long

uint32_t DateTime::get() const
{
    return time2long(date2days(yOff, m, d), hh, mm, ss);
}
开发者ID:juansta,项目名称:intiControl,代码行数:4,代码来源:datetime.cpp

示例13: main

int main(int argc, char *argv[])
{
	struct timeval tv;
	char help_msg[1024] = "Usage: tzconfig [-s <timezone>] [-x <timezone name is encoded according to IEEE 1003.1 (POSIX)>] [-d yyyy-mm-dd] [-j <days of this year>] [-m <[J]<days of this year>] [-i] [-h]\n\n";
	char *tz, *tzname, *date, dst[64], *tmp;
	int c, days;

	strcat(help_msg, "tzconfig command summary\n");
	strcat(help_msg, "\ttzconfig is a function to setup/get timezone infomation.\n");
	strcat(help_msg, "\t-s:setup datetime for specified timezone.\n");
	strcat(help_msg, "\t\t<timezone>(input format):'<+ | ->xx:xx' (x=[0~9]).\n");
	strcat(help_msg, "\t-x:setup datetime for specified timezone name.\n");
	strcat(help_msg, "\t\t<timezone name>(input format):'std offset dst [offset],start[/time],end[/time]' .\n");
	strcat(help_msg, "\t-d:To convert date to days.\n");
	strcat(help_msg, "\t-j:To convert days to date.\n");
	strcat(help_msg, "\t\t leap year : 0 ~ 365 \n");
	strcat(help_msg, "\t\t otherwise : 1 ~ 365 \n");
	strcat(help_msg, "\t-m:To convert 'Jn' to 'Mm.w.d' format. \n");
	strcat(help_msg, "\t\t where 'Jn' is specifies the Julian day, with n between 1 and 365. February 29 is never counted, even in leap years. \n");
	strcat(help_msg, "\t\t where 'n' is the days of this year which means the Julian day, with n between 0 and 365. February 29 is counted in leap years. \n");
	strcat(help_msg, "\t-i:To get the local timezone information.\n");
	strcat(help_msg, "\t-h:To show this help message.\n");

	if(argc <= 1 || ((isgraph(*argv[1]) || ispunct(*argv[1])) && *argv[1]!='-'))
		fprintf(stderr, "%s", help_msg);

	while ((c = getopt(argc, argv, "S:X:s:x:D:d:J:j:M:m:I0:i0:h0:H0:?0:0:-")) != -1){
		switch (c) {
			case 'S':
			case 's':
				tz = optarg;
				setTZ(tz);
				break;
			case 'X':
			case 'x':
				tzname = optarg;
				setTZName(tzname);
				break;
			case 'D':
			case 'd':
				date = optarg;
				days = date2days(date);
				printf("%d\n", days);
				break;
			case 'J':
			case 'j':
				days = atoi(optarg);
				date = StrDup("yyyy-mm-dd");
				days2date(days, date);
				printf("%s\n", date);
				StrFree(date);
				break;
			case 'I':
			case 'i':
				getTZ(&tz);
				printf("本地時區是:UTC%s\n", tz);
				break;
			case 'M':
			case 'm':
				tmp = StrDup(optarg);
				if(strstr(tmp, "J")){
					days = atoi(strmhead(tmp, "J", -1));
					if(days != 59){
						days = days2date(days, dst);
						jds2mds(days, dst);
					}
					else
						printf("Invalid !!!\n");
				}
				else{
					days = atoi(optarg);
					/* step 1 : to find the date by days */
					days = days2date(days, dst);
					/* step 2 : to find the result by Julian day & date */
					jds2mds(days, dst);
				}
				printf("%s\n", dst);
				StrFree(tmp);
				break;
			case 'H':
			case 'h':
			case '?':
			default:
				fprintf(stderr, "%s", help_msg);
				exit(0);
				break;
		}
	}

	return 0;
}
开发者ID:JackieXie168,项目名称:tznconfig,代码行数:91,代码来源:tznconfig.c

示例14: get

long DateTime::get()const{
  uint16_t days=date2days(yOff, m ,d);
  return time2long(days, hh, mm, ss);
}
开发者ID:kliment,项目名称:MCP7940-library-for-logger,代码行数:4,代码来源:MCP7940.cpp

示例15: eeprom_read_byte

void DataWarehouse::init( uint16_t nowYear, uint8_t nowMonth, uint8_t nowDate, uint8_t nowHour )
{
    uint16_t year;
    uint8_t month;
    uint8_t date;

    uint8_t todayIndex;
    boolean valid;

#if _DEBUG
    for ( uint8_t i = 0; i < 20; i++ )
    {
        Serial.print(i);
        Serial.print(": ");
        Serial.println( eeprom_read_byte((const uint8_t *)i), HEX);
    }

#endif

    valid = true;

    if ( DATA_VALID == eeprom_read_byte((const uint8_t *)STORE_ADDR_VALIDFLAG ) )
    {
        todayIndex = eeprom_read_byte((const uint8_t *)STORE_ADDR_TODAYINDEX);

        if ( todayIndex < DATA_SAVE_DAYS )
        {
            uint32_t nowHours, storeHours;

            year = eeprom_read_word((const uint16_t *)STORE_ADDR_YEAR(todayIndex));
            month = eeprom_read_byte((const uint8_t *)STORE_ADDR_MONTH(todayIndex));
            date = eeprom_read_byte((const uint8_t *)STORE_ADDR_DAYDATE(todayIndex));

            storeHours = days2hours( date2days( year, month, date ), END_HOURTIME_ONEDAY);
            nowHours = days2hours( date2days( nowYear, nowMonth, nowDate ), nowHour);

            if ( (nowHours - storeHours) > 12 )
            {
                valid = false;
            }
        }
        else
        {
            valid = false;
        }

    }
    else
    {
        valid = false;
    }

    if ( !valid )
    {
        uint8_t i,j,k;

        eeprom_write_byte( (uint8_t *)STORE_ADDR_VALIDFLAG, ~DATA_VALID );

        for ( i = 0; i < DATA_SAVE_DAYS; i++ )
        {
            writeDateInfo( i, INVALID_UINT16, INVALID_UINT8, INVALID_UINT8);

            for ( j = 0; j < DATA_TYPE_MAXNUM; j++ )
            {
                for ( k = 0; k < SAMPLE_TIMES_PERDAY; k++ )
                {
    				writeData( INVALID_INT16, i, j, k );
                }

            }
        }

        todayIndex = 0;

        eeprom_write_byte((uint8_t *)STORE_ADDR_TODAYINDEX, todayIndex);
        writeDateInfo( todayIndex, nowYear, nowMonth, nowDate );   //record start date, only used internally

        eeprom_write_byte( (uint8_t *)STORE_ADDR_VALIDFLAG, DATA_VALID );


    }

#if _DEBUG
    for ( uint8_t i = 0; i < 20; i++ )
    {
        Serial.print(i);
        Serial.print(": ");
        Serial.println( eeprom_read_byte((const uint8_t *)i), HEX);
    }

#endif


}
开发者ID:pookiemaker,项目名称:Reviews,代码行数:94,代码来源:WeatherStation.cpp


注:本文中的date2days函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。