OnTime library

derez

Expert
Licensed User
Longtime User
The library provides access to system date, time and time zone offset.
It also enables to find the offset at any point by its coordinates.
There are two libraries, for desktop and device.

Methods:

New - initializes the object.

DllVersion - returns the library's version.

GetDate - returns the system date in the format “dd/mm/yyyy”.

GetTime - returns the system time in the format “hh:mm”.

SetDate (int Day, int Month, int Year) - sets the system time to the provided date.

SetTime (int Hour, int Minute, int Second) - sets the system time to the provided time.

GetOffset - returns the system's time zone offset in the format “hh:mm”.

SetOffset (int Hours,int Minutes) - sets the system's time zone offset.

FindZone (double Latitude, double Longitude) - returns the time zone offset of the point defined by its geographic coordinates (not including Daylight Saving changes).
East and North are positive, West and South are negative.
Max North coordinate is 85.3
Min South coordinate is -58.5
Longitude from -180 to + 180 .
To use this method you have to include the two time zone maps in your application's directory.
For the other methods these maps are not required.
Do not change their size as this will ruin the colors in the borders.
The returned time zone may be inaccurate near the zone border.

The attached files include help file, the two dlls, two cs files for integration during compilation and the two maps.

Edit: updated to ver 1.1 - instead of two maps there are four smaller ones, to eliminate memory exceptions due to the map size.

Edit: updated to ver 1.2 - takes into consideration the effect of daylight saving, which sometimes causes shift of one hour when updating system time.
 

Attachments

  • Ontime1.2_part1.zip
    211.3 KB · Views: 97
  • Ontime1.2_part2.zip
    205.9 KB · Views: 91
Last edited:

derez

Expert
Licensed User
Longtime User
Updated to ver 1.1 - instead of two maps there are four smaller ones, to eliminate memory exceptions due to the map size.
 

derez

Expert
Licensed User
Longtime User
Updated to ver 1.2 - takes into consideration the effect of daylight saving, which sometimes causes shift of one hour when updating system time.

I'll appreciate checking by users.

Thanks.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…