Hi, all
I have code:
#include <QtGui/QApplication>
#include <QHBoxLayout>
#include <QLabel>
#include <QDateTime>
#include <QString>
#include <time.h>
int main(int argc, char *argv[])
{
time_t seconds;
seconds=time(NULL);
date_f->setTime_t(seconds);
milisec=date_f->toString(need_f);
lyaout->addWidget(label);
w->setWindowTitle("Try again");
w->setLayout(lyaout);
w->show();
return a.exec();
}
#include <QtGui/QApplication>
#include <QHBoxLayout>
#include <QLabel>
#include <QDateTime>
#include <QString>
#include <time.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget* w =new QWidget;
QHBoxLayout* lyaout = new QHBoxLayout;
QLabel* label;
time_t seconds;
QDateTime* date_f = new QDateTime;
QString milisec;
QString format="mmssz";
QString & need_f=format;
seconds=time(NULL);
date_f->setTime_t(seconds);
milisec=date_f->toString(need_f);
label = new QLabel(milisec);
lyaout->addWidget(label);
w->setWindowTitle("Try again");
w->setLayout(lyaout);
w->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
date_f->setTime_t(seconds) don't return time in milliseconds.
Why is? What method can return time in milliseconds?
Thanks.
Bookmarks