- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
! Getsystime.f90 file shows how to call a Windows API routine
! Since the only routine called is GetSystemTime, only include
! interface definitions from kernel32.mod instead of all modules
! included by ifwin.f90. Type definitions are defined in IFWINTY,
! which is used within KERNEL32.
PROGRAM Getsystime
USE KERNEL32
TYPE (T_SYSTEMTIME) MYTIME
CALL GetSystemTime(MYTIME)
WRITE (*,*) 'Current UTC time year :: ', Mytime.wyear, ' Month :: ', Mytime.wMonth, ' Day :: ', Mytime.wDay,' Hour :: ', Mytime.wHour, ' Minute :: ', Mytime.Wminute, ' Second :: ', Mytime.Wsecond
END PROGRAM
On page 627 of the manual you provide a nice little sample of grabbing the time, but it would be nicer if it gave you the whole date and then you can cut it down instead of having to guess what is in the structure type.
Just a thought.
This works.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, @JohnNichols. I submitted a feature request, DOC-10965.
I shortened that LONG line a bit. The DGR lines aren't that long, no scrollbar either.
! Getsystime.f90 file shows how to call a Windows API routine
! Since the only routine called is GetSystemTime, only include
! interface definitions from kernel32.mod instead of all modules
! included by ifwin.f90. Type definitions are defined in IFWINTY,
! which is used within KERNEL32.
PROGRAM Getsystime
USE KERNEL32
TYPE (T_SYSTEMTIME) MYTIME
CALL GetSystemTime(MYTIME)
WRITE (*,*) 'Current UTC time year :: ', Mytime.wYear, &
' Month :: ', Mytime.wMonth, ' Day :: ', Mytime.wDay, &
' Hour :: ', Mytime.wHour, ' Minute :: ', Mytime.wMinute, &
' Second :: ', Mytime.wSecond
END PROGRAM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The expanded example you submitted is published now in the Fortran Developer Guide 2023.1.
Check it out.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page