November 08, 2008

What happened to LocalFileTimeToFileTime() / FileTimeToLocalFileTime()?

When you want to convert a time between UTC and local, you may choose the API LocalFileTimeToFileTime() or FileTimeToLocalFileTime() for this job.

Do you know you may get an unexpected result if it is daylight saving time?

LocalFileTimeToFileTime() and FileTimeToLocalFileTime() use the current settings for the time zone and daylight saving time. Therefore, if it is daylight saving time, these functions will take daylight saving time into account, even if the time you are converting is in standard time.

Solution:
You can use SystemTimeToTzSpecificLocalTime() and TzSpecificLocalTimeToSystemTime() instead.

Reference in This Site:

Reference in MSDN:

November 03, 2008

Why is INSERT / UPDATE command very bad performance on SQLite?

When you do a lot of INSERT / UPDATE on a table, it is a good time to contain them within a transaction,

begin;
insert into table values (..);
insert into table values (..);
insert into table values (..);
....
commit;

This will make SQLite save all changes to the disk at once.

Reference in SQLite:
http://www.sqlite.org/cvstrac/wiki?p=PerformanceConsiderations