示例#1
0
文件: timer.c 项目: MasterSS/HOS
void timer_install() {
    irq_install_handler ( 0, timer_handler );
    T.uptime = 0;
    T.ticks = 0;
    clock = 0;
    set_timer_interval();
}
示例#2
0
LocalZipTask::LocalZipTask(rc_ptr<ThreadPool> tp, TimerManager *tmgr, rc_ptr<XmlElement> config)
    : AbstractSyncTask(tp, tmgr)
{
    assert(tp.is_not_null() && NULL != tmgr && config.is_not_null());
    const string& name = config->get_name();
    set_name(QString::fromLocal8Bit(name.data(), name.length()));

    rc_ptr<XmlElement> x = config->get_child("source");
    if (x.is_not_null())
    {
        const string& text = x->get_text();
        set_source(QString::fromLocal8Bit(text.data(), text.length()));
    }
    else
    {
        NUT_LOG_E("plugin.syncer.localzip", "source path is missing for task %s",
            get_name().toLocal8Bit().data());
    }

    x = config->get_child("destination");
    if (x.is_not_null())
    {
        const string text = x->get_text();
        set_destination(QString::fromLocal8Bit(text.data(), text.length()));
    }
    else
    {
        NUT_LOG_E("plugin.syncer.localzip", "destination path is missing for task %s",
            get_name().toLocal8Bit().data());
    }

    x = config->get_child("timer");
    if (x.is_not_null())
    {
        const string text = x->get_text();
        const time_t secs = QString::fromLocal8Bit(text.data(), text.length()).toLong();
        set_timer_interval(secs);
    }

    start_timer();
}