本文整理汇总了C++中set_time函数的典型用法代码示例。如果您正苦于以下问题:C++ set_time函数的具体用法?C++ set_time怎么用?C++ set_time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_time函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: do_update_time
/**
* Handler for minute tick
* Updates the text layer if needed and triggers updating
* of the minute layer
*/
static void do_update_time(struct tm *current_time) {
// update the time variables
set_time(current_time);
// update the hour layer
text_layer_set_text(hour_layer, hour_display);
text_layer_set_text(day_layer, day_string);
if(has_tapped) {
// determine wether hours or date should be visible
layer_set_hidden(text_layer_get_layer(hour_layer), true);
layer_set_hidden(text_layer_get_layer(day_layer), false);
layer_set_hidden(text_layer_get_layer(month_layer), false);
} else {
layer_set_hidden(text_layer_get_layer(hour_layer), false);
layer_set_hidden(text_layer_get_layer(day_layer), true);
layer_set_hidden(text_layer_get_layer(month_layer), true);
}
// re-set the bounds. we shouldn't be doing this from
// .update_proc, change doesn't take effect until next render.
// but as we're doing this far in advance, it will be ok by
// the time it's needed
set_minute_bounds(minutes);
// mark the minute layer as dirty so it will be redrawn
layer_mark_dirty(minute_layer);
layer_mark_dirty(deco_layer);
}
开发者ID:cottow,项目名称:pebble,代码行数:34,代码来源:fullcircle.c
示例2: GOOGLE_CHECK_NE
void Message::MergeFrom(const Message& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_to()) {
set_to(from.to());
}
if (from.has_id()) {
set_id(from.id());
}
if (from.has_time()) {
set_time(from.time());
}
if (from.has_from()) {
set_from(from.from());
}
if (from.has_type()) {
set_type(from.type());
}
if (from.has_sn()) {
set_sn(from.sn());
}
if (from.has_data()) {
set_data(from.data());
}
if (from.has_expire()) {
set_expire(from.expire());
}
}
}
开发者ID:acechat,项目名称:GPush,代码行数:29,代码来源:message.pb.cpp
示例3: comm_select
/*
* comm_select
*
* Called to do the new-style IO, courtesy of squid (like most of this
* new IO code). This routine handles the stuff we've hidden in
* comm_setselect and fd_table[] and calls callbacks for IO ready
* events.
*/
void
comm_select(void)
{
int num, i;
static struct kevent ke[KE_LENGTH];
struct timespec poll_time;
void (*hdl)(fde_t *, void *);
fde_t *F;
/*
* remember we are doing NANOseconds here, not micro/milli. God knows
* why jlemon used a timespec, but hey, he wrote the interface, not I
* -- Adrian
*/
poll_time.tv_sec = 0;
poll_time.tv_nsec = SELECT_DELAY * 1000000;
num = kevent(kqfd.fd, kq_fdlist, kqoff, ke, KE_LENGTH, &poll_time);
kqoff = 0;
set_time();
if (num < 0)
{
const struct timespec req = { .tv_sec = 0, .tv_nsec = 50000000 };
nanosleep(&req, NULL); /* Avoid 99% CPU in comm_select */
return;
}
for (i = 0; i < num; i++)
{
F = lookup_fd(ke[i].ident);
if (F == NULL || !F->flags.open || (ke[i].flags & EV_ERROR))
continue;
if (ke[i].filter == EVFILT_READ)
{
if ((hdl = F->read_handler) != NULL)
{
F->read_handler = NULL;
hdl(F, F->read_data);
if (!F->flags.open)
continue;
}
}
if (ke[i].filter == EVFILT_WRITE)
{
if ((hdl = F->write_handler) != NULL)
{
F->write_handler = NULL;
hdl(F, F->write_data);
if (!F->flags.open)
continue;
}
}
comm_setselect(F, 0, NULL, NULL, 0);
}
}
开发者ID:Adam-,项目名称:ircd-hybrid,代码行数:67,代码来源:s_bsd_kqueue.c
示例4: set_time
void device_rtc_interface::set_current_time(running_machine &machine)
{
system_time systime;
machine.base_datetime(systime);
set_time(true, systime.local_time.year, systime.local_time.month + 1, systime.local_time.mday, systime.local_time.weekday + 1,
systime.local_time.hour, systime.local_time.minute, systime.local_time.second);
}
开发者ID:Ilgrim,项目名称:MAMEHub,代码行数:8,代码来源:dirtc.c
示例5: set_time_callback
/** Callback to set receiver GPS time estimate. */
static void set_time_callback(u16 sender_id, u8 len, u8 msg[], void* context)
{
(void)sender_id; (void)len; (void) context;
gps_time_t *t = (gps_time_t *)msg;
set_time(TIME_COARSE, *t);
}
开发者ID:EmuxEvans,项目名称:piksi_firmware,代码行数:9,代码来源:timing.c
示例6: set_time
blargg_err_t Nsf_Emu::run_clocks( blip_time_t& duration, int )
{
set_time( 0 );
while ( time() < duration )
{
nes_time_t end = min( next_play, duration );
end = min( end, time() + 32767 ); // allows CPU to use 16-bit time delta
if ( cpu::run( end ) )
{
if ( r.pc != badop_addr )
{
set_warning( "Emulation error (illegal instruction)" );
r.pc++;
}
else
{
play_ready = 1;
if ( saved_state.pc != badop_addr )
{
cpu::r = saved_state;
saved_state.pc = badop_addr;
}
else
{
set_time( end );
}
}
}
if ( time() >= next_play )
{
nes_time_t period = (play_period + play_extra) / clock_divisor;
play_extra = play_period - period * clock_divisor;
next_play += period;
if ( play_ready && !--play_ready )
{
check( saved_state.pc == badop_addr );
if ( r.pc != badop_addr )
saved_state = cpu::r;
r.pc = play_addr;
low_mem [0x100 + r.sp--] = (badop_addr - 1) >> 8;
low_mem [0x100 + r.sp--] = (badop_addr - 1) & 0xFF;
GME_FRAME_HOOK( this );
}
}
开发者ID:Lin20,项目名称:projectpmr,代码行数:46,代码来源:Nsf_Emu.cpp
示例7: tick_handler
static void tick_handler(struct tm *tick_time, TimeUnits units_changed){
set_time();
if(mins != 0 && (tick_time->tm_min +(tick_time->tm_hour*60))%mins == 0){
vibes_double_pulse();
APP_LOG(APP_LOG_LEVEL_DEBUG, "fmt");
}
}
开发者ID:nmittu,项目名称:Nixie-Watch,代码行数:8,代码来源:main.c
示例8: TimedCallback
GameTimedCallback::GameTimedCallback(CallBack *t, void *d, uint32 wait_time, bool repeating)
: TimedCallback(t, d, wait_time, repeating)
{
// re-queue timer using game ticks
dequeue();
real_time = TIMER_GAMETIME;
set_time();// change to game time
queue(); // start
}
开发者ID:nuvie,项目名称:nuvie,代码行数:9,代码来源:TimedEvent.cpp
示例9: Set_time
int Set_time(unsigned char * time_buf)
{
int ret;
char rtc_string[40];
ret = set_time(time_buf[0],time_buf[1],time_buf[2],time_buf[3],time_buf[4],time_buf[5],time_buf[6]);
sprintf(rtc_string,"date %02d%02d%02d%02d%02d%02d.%02d",time_buf[2],time_buf[3],time_buf[4],time_buf[5],time_buf[0],time_buf[1],time_buf[6]);
system(rtc_string);
return ret;
}
开发者ID:yst1571661,项目名称:EquipSharedSystemLM,代码行数:9,代码来源:device.c
示例10: comm_select
void
comm_select(unsigned long delay)
{
int num, i, fd;
static struct kevent ke[KE_LENGTH];
struct timespec poll_time;
PF *hdl;
fde_t *F;
/*
* remember we are doing NANOseconds here, not micro/milli. God knows
* why jlemon used a timespec, but hey, he wrote the interface, not I
* -- Adrian
*/
poll_time.tv_sec = 0;
poll_time.tv_nsec = delay * 1000000;
num = kevent(kq, kqlst, kqoff, ke, KE_LENGTH, &poll_time);
kqoff = 0;
while (num < 0 && ignoreErrno(errno))
num = kevent(kq, kqlst, 0, ke, KE_LENGTH, &poll_time);
set_time();
for (i = 0; i < num; i++)
{
fd = (int) ke[i].ident;
hdl = NULL;
F = &fd_table[fd];
if (ke[i].flags & EV_ERROR)
{
errno = ke[i].data;
/* XXX error == bad! -- adrian */
continue; /* XXX! */
}
switch (ke[i].filter)
{
case EVFILT_READ:
if ((hdl = F->read_handler) != NULL)
{
F->read_handler = NULL;
hdl(fd, F->read_data);
}
case EVFILT_WRITE:
if ((hdl = F->write_handler) != NULL)
{
F->write_handler = NULL;
hdl(fd, F->write_data);
}
default:
/* Bad! -- adrian */
break;
}
}
}
开发者ID:BackupTheBerlios,项目名称:shadowircd,代码行数:57,代码来源:s_bsd_kqueue.c
示例11: comm_select
/*
* comm_select
*
* Called to do the new-style IO, courtesy of of squid (like most of this
* new IO code). This routine handles the stuff we've hidden in
* comm_setselect and fd_table[] and calls callbacks for IO ready
* events.
*/
void
comm_select(void)
{
int num, ci;
void (*hdl)(fde_t *, void *);
fde_t *F;
num = poll(pollfds, pollnum, SELECT_DELAY);
set_time();
if (num < 0)
{
#ifdef HAVE_USLEEP
usleep(50000); /* avoid 99% CPU in comm_select */
#endif
return;
}
for (ci = 0; ci < pollnum && num > 0; ci++)
{
int revents = pollfds[ci].revents;
if (revents == 0)
continue;
num--;
F = lookup_fd(pollfds[ci].fd);
assert(F);
if (!F->flags.open)
continue;
if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR))
{
if ((hdl = F->read_handler) != NULL)
{
F->read_handler = NULL;
hdl(F, F->read_data);
if (!F->flags.open)
continue;
}
}
if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR))
{
if ((hdl = F->write_handler) != NULL)
{
F->write_handler = NULL;
hdl(F, F->write_data);
if (!F->flags.open)
continue;
}
}
comm_setselect(F, 0, NULL, NULL, 0);
}
}
开发者ID:codemstr,项目名称:eircd-hybrid-8,代码行数:65,代码来源:s_bsd_poll.c
示例12: acl_assert
acl_int64 event_timer::trigger(void)
{
// sanity check
if (tasks_.empty())
return TIMER_EMPTY;
acl_assert(length_ > 0);
set_time();
std::list<event_task*> tasks;
// 从定时器中取出到达的定时任务
for (std::list<event_task*>::iterator it = tasks_.begin();
it != tasks_.end();)
{
if ((*it)->when > present_)
break;
tasks.push_back(*it);
it = tasks_.erase(it);
length_--;
}
if (tasks.empty())
{
acl_assert(!tasks_.empty());
event_task* first = tasks_.front();
acl_int64 delay = first->when - present_;
return delay < 0 ? 0 : delay;
}
for (std::list<event_task*>::iterator it = tasks.begin();
it != tasks.end(); ++it)
{
set_task(*it);
// 调用子类虚函数,触发定时器任务过程
timer_callback((*it)->id);
}
tasks.clear();
// 子类有可能会在 timer_callback 中删除了所有的定时任务
if (tasks_.empty())
return TIMER_EMPTY;
event_task* first = tasks_.front();
acl_int64 delay = first->when - present_;
if (delay < 0)
return 0;
else if (delay > first->delay) /* xxx */
return first->delay;
else
return delay;
}
开发者ID:FlowSea,项目名称:acl,代码行数:57,代码来源:event_timer.cpp
示例13: sendPrintTime
void CommandSocket::sendPrintTime()
{
#ifdef ARCUS
auto message = std::make_shared<cura::proto::ObjectPrintTime>();
message->set_time(FffProcessor::getInstance()->getTotalPrintTime());
message->set_material_amount(FffProcessor::getInstance()->getTotalFilamentUsed(0));
private_data->socket->sendMessage(message);
#endif
}
开发者ID:976717326,项目名称:CuraEngine,代码行数:9,代码来源:commandSocket.cpp
示例14: comm_select
/*
* comm_select
*
* Called to do the new-style IO, courtesy of squid (like most of this
* new IO code). This routine handles the stuff we've hidden in
* comm_setselect and fd_table[] and calls callbacks for IO ready
* events.
*/
void
comm_select(void)
{
struct timeval to;
int num, fd;
fde_t *F;
PF *hdl;
/* Copy over the read/write sets so we don't have to rebuild em */
memcpy(&tmpreadfds, &select_readfds, sizeof(fd_set));
memcpy(&tmpwritefds, &select_writefds, sizeof(fd_set));
to.tv_sec = 0;
to.tv_usec = SELECT_DELAY * 1000;
num = select(highest_fd + 1, &tmpreadfds, &tmpwritefds, NULL, &to);
set_time();
if (num < 0)
{
#ifdef HAVE_USLEEP
usleep(50000);
#endif
return;
}
for (fd = 0; fd <= highest_fd && num > 0; fd++)
if (FD_ISSET(fd, &tmpreadfds) || FD_ISSET(fd, &tmpwritefds))
{
num--;
F = lookup_fd(fd);
if (F == NULL || !F->flags.open)
continue;
if (FD_ISSET(fd, &tmpreadfds))
if ((hdl = F->read_handler) != NULL)
{
F->read_handler = NULL;
hdl(F, F->read_data);
if (!F->flags.open)
continue;
}
if (FD_ISSET(fd, &tmpwritefds))
if ((hdl = F->write_handler) != NULL)
{
F->write_handler = NULL;
hdl(F, F->write_data);
if (!F->flags.open)
continue;
}
comm_setselect(F, 0, NULL, NULL, 0);
}
}
开发者ID:Adam-,项目名称:oftc-hybrid,代码行数:64,代码来源:s_bsd_select.c
示例15: option_checker
/* option_checker()'s role is ONLY check "short option" */
void option_checker(int argc, char ** argv)
{
int opt;
/* long option's define */
static struct option loption[] = {
{"help", no_argument, NULL, 'h'},
{"time", required_argument, NULL, 't'},
{"file", required_argument, NULL, 'f'}
};
/* check the number of argument */
if(argc == 1) {
error_procedure("number of argument");
}
/* set all modes to OFF */
set_mode();
/* check short options */
while((opt = getopt_long(argc, argv, "mbv:plzt:f:h", loption, NULL)) != -1) {
switch(opt) {
case 'b':
set_tabu2opt_mode();
break;
case 'm':
set_parallel_mode();
break;
case 'v':
set_visual_mode(atoi(optarg));
break;
case 'p':
set_parallel_mode();
break;
case 'l':
set_pole_mode();
break;
case 'z':
set_tozaki_mode();
break;
case 't':
set_time(INIT,atoi(optarg));
break;
case 'f':
read_data_set(optarg);
break;
case 'h':
if(argc == 2) {
help_document(argv);
}
break;
case '?':
error_procedure("comand-line option");
break;
}
}
}
开发者ID:HasegawaYunosuke,项目名称:Old-Tabu-Search,代码行数:57,代码来源:argument.c
示例16: set_delay_time
int set_delay_time(alphabet_game_t *alphabet_game, unsigned int usec)
{
alphabet_game_t *ag=alphabet_game;
unsigned int us=usec;
if(NULL==ag){
return RET_FAILED;
}
return set_time(&ag->delay_time,us);
}
开发者ID:handsomezhou,项目名称:programming_notes_for_c,代码行数:10,代码来源:alphabet_game.c
示例17: gst_rtsp_range_convert_units
gboolean
gst_rtsp_range_convert_units (GstRTSPTimeRange * range, GstRTSPRangeUnit unit)
{
if (range->unit == unit)
return TRUE;
if (range->min.type == GST_RTSP_TIME_NOW ||
range->max.type == GST_RTSP_TIME_NOW)
return FALSE;
set_time (&range->min, &range->min2, unit,
get_time (range->unit, &range->min, &range->min2));
set_time (&range->max, &range->max2, unit,
get_time (range->unit, &range->max, &range->max2));
range->unit = unit;
return TRUE;
}
开发者ID:ConfusedReality,项目名称:pkg_multimedia_gst-plugins-base,代码行数:19,代码来源:gstrtsprange.c
示例18: main
int main() {
char buffer[32] = {0};
set_time(CUSTOM_TIME); // Set RTC time to Wed, 28 Oct 2009 11:35:37
while(1) {
time_t seconds = time(NULL);
strftime(buffer, 32, "%Y-%m-%d %H:%M:%S %p", localtime(&seconds));
printf("[%ld] [%s]\n", seconds, buffer);
wait(1);
}
}
开发者ID:haydar9,项目名称:mbed,代码行数:10,代码来源:main.cpp
示例19: set_time
void DogStateCart3::read_frame(int nframe)
{
//DogState::read(nframe, get_outputdir());
set_time(ReadStateArray(get_outputdir(), "q", *q, nframe));
if (dogParams.get_maux()>0)
{
const double t = ReadStateArray(get_outputdir(), "a", *aux, nframe);
assert_eq(t, get_time());
}
}
开发者ID:smoe1,项目名称:ImplicitExplicit,代码行数:10,代码来源:DogStateCart3.cpp
示例20: TEST_BEGIN
void *POSIX_Init(
void *argument
)
{
int status;
useconds_t result;
struct sigaction act;
sigset_t mask;
TEST_BEGIN();
/* set the time of day, and print our buffer in multiple ways */
set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
/* get id of this thread */
Init_id = pthread_self();
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
Signal_occurred = 0;
Signal_count = 0;
/* Validate ualarm is ignored if signal not caught */
act.sa_handler = Signal_handler;
act.sa_flags = 0;
sigaction( SIGALRM, &act, NULL );
puts( "Init: ualarm in 1 us" );
sleep(3);
result = ualarm(1,0);
rtems_test_assert( result == 0 );
status = sleep(10);
rtems_test_assert( status == 0 );
/* unblock Signal and see if it happened */
status = sigemptyset( &mask );
rtems_test_assert( !status );
status = sigaddset( &mask, SIGALRM );
rtems_test_assert( !status );
puts( "Init: Unblock SIGALRM" );
status = sigprocmask( SIG_UNBLOCK, &mask, NULL );
rtems_test_assert( !status );
status = sleep(10);
/* stop ularm */
puts( "Init: clear ualarm with 0,0" );
result = ualarm(0,0);
status = sleep(10);
TEST_END();
rtems_test_exit(0);
return NULL; /* just so the compiler thinks we returned something */
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:55,代码来源:init.c
注:本文中的set_time函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论