Skip to content

Instantly share code, notes, and snippets.

@wimleers
Created November 20, 2010 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wimleers/707963 to your computer and use it in GitHub Desktop.
Save wimleers/707963 to your computer and use it in GitHub Desktop.
main.cpp
#include <QDateTime>
#include <QTime>
#include <QTextStream>
#define NUM_CALLS 1000
int main(int argc, char *argv[]) {
QTextStream cout(stdout);
QTime timer;
timer.start();
for (int i = 0; i < NUM_CALLS; i++)
QDateTime::fromString("14-Nov-2010 16:10:00", "dd-MMM-yyyy HH:mm:ss");
cout << timer.elapsed() << " ms were necessary for parsing the date " << NUM_CALLS<< " times." << endl;
}
#-------------------------------------------------
#
# Project created by QtCreator 2010-11-20T18:00:03
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = DateTimeFromStringPerfTest
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment