| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | set time with emx: how ?? |
Hi,
This is so simple! Just use the DATETIME structure to set and get date and
time. There are other ways, but this seems to be a simple one. If you
look inside the OS2EMX.H file, and look under the TIMERS section, you'll
find other things like seconds,hundredths,timezone,and weekday. Also, get
the file PRCP.ZIP (I think it's called that). It has PRCP.INF file which
gives you examples and meanings for different DOS APIs, etc.. That's where
I learned this (The below is from the example from PRCP.INF. I Just
modified it a bit.).
#define INCL_DOSDATETIME
#include
main()
{
DATETIME DateTime; // Structure for date and time
DosGetDateTime(&DateTime); // Get date and time information
// Show current date and time
printf("Today's date is %d//%d//%d and time is
%d:%d\n",DateTime.day,
DateTime.month,DateTime.year,DateTime.hour,DateTime.minutes);
// You can change the date and/or time to anything. The below is an example
DateTime.day = 8; // Set day to 8
DateTime.month = 9; // Set month to 9 (Sepetmber)
DateTime.year = 1999; // Year to 1999
DateTime.hour = 3; // Hour to 3
DateTime.minutes = 35; // Minutes to 35
// Show new date and time
printf("New date is %d-%d-%d and new time is
%d:%d\n",DateTime.day,
DateTime.month,DateTime.year,DateTime.hour,DateTime.minutes);
// Change to new date and time
DosSetDateTime(&DateTime);
}
Hope this helps!
Bye!
--- Maximus/2 3.00
* Origin: One Less Car * TorontOS/2 * (416) 480-0147 * (1:250/238)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 517 628 713/888 800/1 @PATH: 250/238 2424/11 24 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.