本文整理汇总了C++中settime函数的典型用法代码示例。如果您正苦于以下问题:C++ settime函数的具体用法?C++ settime怎么用?C++ settime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPdMode
/*
* set PD mode (DN_PDMODE)
*/
LOCAL ER setPdMode( PdMode *mode )
{
#define settime(time) \
if ( mode->time >= 0 ) { \
kpMgrInfo.pd.pdMode.time \
= min(mode->time, PD_MAXTIME); \
}
union {
PdAttr attr;
UW uw;
} u;
/* change PD mode */
settime(ontime);
settime(offtime);
settime(invtime);
settime(timeout);
kpMgrInfo.pd.pdMode.attr = mode->attr;
/* change PD scan frequency */
kpChangePdScanRate(mode->attr.rate);
/* change sensitivity */
u.attr = mode->attr;
kpChangePdSense(u.uw & (PD_ACMSK|PD_ABS|PD_SNMSK));
return E_OK;
#undef settime
}
示例2: save_minimum
void
save_minimum()
{
if (results->N == 0) {
save_n(1);
settime(0);
} else {
save_n(results->v[results->N - 1].n);
settime(results->v[results->N - 1].u);
}
}
示例3: save_minimum
void
save_minimum()
{
if (results.N == 0) {
save_n(1);
settime(0);
} else {
save_n(results.n[results.N - 1]);
settime(results.u[results.N - 1]);
}
}
示例4: comhandle
void comhandle()
{
serial_println("");
serial_println("Welcome to the MPX OS.");
serial_println("Feel free to begin entering commands.");
serial_println("");
while(1) {
char *command = polling();
if (!strcmpigncase(command, "Shutdown")) {
if (shutdownConfirmed()) {
serial_println("System shutting down...");
break;
} else {
serial_println("Shutdown canceled.");
}
} else if (!strcmpigncase(command, "Version")) {
version();
} else if (!strcmpigncase(command, "Help")) {
help();
} else if (!strcmpigncase(command, "Setdate")) {
setdate();
} else if (!strcmpigncase(command, "Getdate")) {
getdate();
} else if (!strcmpigncase(command, "Settime")) {
settime();
} else if (!strcmpigncase(command, "Gettime")) {
gettime();
}
}
}
示例5: compat_50_netbsd32_settimeofday
int
compat_50_netbsd32_settimeofday(struct lwp *l,
const struct compat_50_netbsd32_settimeofday_args *uap, register_t *retval)
{
/* {
syscallarg(const netbsd32_timeval50p_t) tv;
syscallarg(const netbsd32_timezonep_t) tzp;
} */
struct netbsd32_timeval50 atv32;
struct timeval atv;
struct timespec ats;
int error;
struct proc *p = l->l_proc;
/* Verify all parameters before changing time. */
/*
* NetBSD has no kernel notion of time zone, and only an
* obsolete program would try to set it, so we log a warning.
*/
if (SCARG_P32(uap, tzp))
printf("pid %d attempted to set the "
"(obsolete) kernel time zone\n", p->p_pid);
if (SCARG_P32(uap, tv) == 0)
return 0;
if ((error = copyin(SCARG_P32(uap, tv), &atv32, sizeof(atv32))) != 0)
return error;
netbsd32_to_timeval50(&atv32, &atv);
TIMEVAL_TO_TIMESPEC(&atv, &ats);
return settime(p, &ats);
}
示例6: n_settimestamp
/* settimestamp(seconds1970) sets the date and time from a single parameter: the
* number of seconds since 1 January 1970.
*/
static cell AMX_NATIVE_CALL n_settimestamp(AMX *amx, const cell *params)
{
#if defined __WIN32__ || defined _WIN32 || defined WIN32
int year, month, day, hour, minute, second;
stamp2datetime(params[1],
&year, &month, &day,
&hour, &minute, &second);
setdate(year, month, day);
settime(hour, minute, second);
#else
/* Linux/Unix (and some DOS compilers) have stime(); on Linux/Unix, you
* must have "root" permission to call stime(); many POSIX systems will
* have settimeofday() instead
*/
#if defined __APPLE__ /* also valid for other POSIX systems */
struct timeval tv;
tv.tv_sec = params[1];
tv.tv_usec = 0;
settimeofday(&tv, 0);
#else
time_t sec1970=(time_t)params[1];
stime(&sec1970);
#endif
#endif
(void)amx;
return 0;
}
示例7: __Disc_SetTime
void __Disc_SetTime(void) {
/* Extern */
extern void settime(u64);
/* Set proper time */
settime(secs_to_ticks(time(NULL) - 946684800));
}
示例8: test_AlwaysInLimit
void
test_AlwaysInLimit(void) {
/* Timestamp is: 2010-01-02 11:00:00Z */
const u_int32 timestamp = 3471418800UL;
const u_short prime_incs[] = { 127, 151, 163, 179 };
int cyc;
int yday;
u_char whichprime;
u_short ydayinc;
int hour;
int minute;
int second;
u_long yearstart;
u_int32 actual;
u_int32 diff;
yearstart = 0;
for (cyc = 0; cyc < 5; cyc++) {
settime(1900 + cyc * 65, 1, 1, 0, 0, 0);
for (yday = -26000; yday < 26000; yday += ydayinc) {
whichprime = abs(yday) % COUNTOF(prime_incs);
ydayinc = prime_incs[whichprime];
for (hour = -204; hour < 204; hour += 2) {
for (minute = -60; minute < 60; minute++) {
clocktime(yday, hour, minute, 30, 0,
timestamp, &yearstart, &actual);
diff = actual - timestamp;
if (diff >= 0x80000000UL)
diff = ~diff + 1;
TEST_ASSERT_TRUE(isLE(diff, (183u * SECSPERDAY)));
}
}
}
}
}
示例9: __distub_restregs
void __distub_restregs(void)
{
int i;
for(i=1;i<6;i++)
_piReg[i] = di_regs.piReg[i];
//i = _piReg[0]; //clear all interrupts
settime(di_regs.timebase);
}
示例10: settime
// ppstate: -1: full strength 0: even strength 1: vis power play 2: home power play
void HockeyDrop::ppdata(short adv, unsigned short strength, unsigned short pmin, unsigned short psec) {
if ( adv == 0 ) {
if (strength == 5) {
lines[SI_PP] = "FULL STRENGTH";
lines[SI_PP_EN] = "EMPTY NET";
// automatically change to the normal (yellow) EMPTY NET graphic when
// the power play expires (assumes same team has PP and EN simultaneously)
if (state == SI_PP_EN && ppstate > 0) state = SI_EN_V - 1 + ppstate;
settime(0,0);
ppstate = -1;
}
else {
if (strength == 4) {
lines[SI_PP] = "4-ON-4";
lines[SI_PP_EN] = "4-ON-4 + EMPTY NET";
}
else if (strength == 3) {
lines[SI_PP] = "3-ON-3";
lines[SI_PP_EN] = "3-ON-3 + EMPTY NET";
}
settime(pmin, psec);
ppstate = 0;
}
}
else if ( abs(adv) == 1 ) {
if (strength == 3) {
lines[SI_PP] = "4-ON-3";
lines[SI_PP_EN] = "4-ON-3 + EMPTY NET";
}
else {
lines[SI_PP] = "POWER PLAY";
lines[SI_PP_EN] = "PP + EMPTY NET";
}
settime(pmin, psec);
if (adv > 0) ppstate = 1;
else ppstate = 2;
}
else if ( abs(adv) == 2 ) {
lines[SI_PP] = "2-MAN ADV";
lines[SI_PP_EN] = "2MA + EMPTY NET";
settime(pmin, psec);
if (adv > 0) ppstate = 1;
else ppstate = 2;
}
else state = -1; // invalid case
}
示例11: main
void main (void)
{
struct time desired_time;
desired_time.ti_hour = 12;
desired_time.ti_min = 30;
settime(&desired_time);
}
示例12: setUp
void
setUp()
{
ntpcal_set_timefunc(timefunc);
settime(1970, 1, 1, 0, 0, 0);
init_lib();
return;
}
示例13: lrintf
void
Reverb::settype (int Ptype)
{
const int NUM_TYPES = 2;
int combtunings[NUM_TYPES][REV_COMBS] = {
//this is unused (for random)
{0, 0, 0, 0, 0, 0, 0, 0},
//Freeverb by Jezar at Dreampoint
{1116, 1188, 1277, 1356, 1422, 1491, 1557, 1617}
};
int aptunings[NUM_TYPES][REV_APS] = {
//this is unused (for random)
{0, 0, 0, 0},
//Freeverb by Jezar at Dreampoint
{225, 341, 441, 556}
};
if (Ptype >= NUM_TYPES)
Ptype = NUM_TYPES - 1;
this->Ptype = Ptype;
float tmp;
for (int i = 0; i < REV_COMBS * 2; i++) {
if (Ptype == 0)
tmp = 800.0f + (float)(RND*1400.0f);
else
tmp = (float)combtunings[Ptype][i % REV_COMBS];
tmp *= roomsize;
if (i > REV_COMBS)
tmp += 23.0f;
tmp *= fSAMPLE_RATE / 44100.0f; //adjust the combs according to the samplerate
if (tmp < 10)
tmp = 10;
comblen[i] = lrintf(tmp);
combk[i] = 0;
lpcomb[i] = 0;
};
for (int i = 0; i < REV_APS * 2; i++) {
if (Ptype == 0)
tmp = 500.0f + (float)(RND*500.0f);
else
tmp = (float)aptunings[Ptype][i % REV_APS];
tmp *= roomsize;
if (i > REV_APS)
tmp += 23.0f;
tmp *= fSAMPLE_RATE / 44100.0f; //adjust the combs according to the samplerate
if (tmp < 10)
tmp = 10;
aplen[i] = lrintf(tmp);
apk[i] = 0;
};
settime (Ptime);
cleanup ();
};
示例14: fb_hSetTime
int fb_hSetTime( int h, int m, int s )
{
struct time t;
t.ti_hour = h;
t.ti_min = m;
t.ti_sec = s;
t.ti_hund = 0;
settime(&t);
return 0;
}
示例15: main
main()
{
struct time curtm;
gettime(&curtm);
printf("\nCurrent time %02d:%02d:%02d.%d",curtm.ti_hour,curtm.ti_min,curtm.ti_sec,curtm.ti_hund);
curtm.ti_hour=20;
settime(&curtm);
gettime(&curtm);
printf("\nAfter setting time %02d:%02d:%02d.%d",curtm.ti_hour,curtm.ti_min,curtm.ti_sec,curtm.ti_hund);
getch();
}