Jump to content

DosGetDateTime: Difference between revisions

From EDM2
No edit summary
 
Ak120 (talk | contribs)
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==DosGetDateTime(pdtm) :
'''DosGetDateTime''' gets the current date and time.  
Get the current date and time.


=== Parameters ===
== Syntax==
; pdtm - [[OS2 API:DataType:PDATETIME|PDATETIME]] - input :
DosGetDateTime ( pdtm )
pointer to a structure where the date and time information is to be stored.


=== Constants ===
== Parameters ==
;pdtm - [[PDATETIME]] - input: Pointer to a [[DATETIME]] structure where the date and time information is to be stored.


=== Returns ===
== Returns ==
This function returns an [[OS2 API:DataType:APIRET|APIRET]] with no values.
This function returns an [[APIRET]] with no values.
APIRET  rc
0      NO_ERROR


=== Module ===
== Define (C/C++) ==
#define INCL_DOSDATETIME
#include <os2.h>


== Export name/Ordinal ==
DOSCALLS.DLL 230.


=== Define (C/C++) ===
== Gotchas==
#define INCL_DOSDATETIME
The sign of the time zone is opposed to that ordinary used. Ie GMT+1 (Western Europe) <=> -60
#include <os2.h>


=== Export name/Ordinal ===
== Sample Code==
DosGetDateTime.  DOSCALLS.DLL 230.
<code>
 
  PDATETIME  pdtm;
=== Calling conversion ===
  DATETIME   dtm;
 
  APIRET     rc;
 
=== Example Code ===
...
  [[OS2 API:DataType:PDATETOME|PDATETIME]] pdtm;
  [[OS2 API:DataType:DATETIME|DATETIME]]    dtm;
  [[OS2 API:DataType:APIRET|APIRET]]        rc;
  ...
  ...
  pdtm = &dtm;
  pdtm = &dtm;
  rc = DosGetDateTime (pdtm);
  rc = DosGetDateTime (pdtm);
...


=== Related Functions ===
#define INCL_DOSDATETIME
[[OS2 API:DosSetDateTime|DosSetDateTime]]
#include <os2.h>
#include <stdio.h> /* For printf */
DATETIME dt;
APIRET rc;
rc=DosGetDateTime(&dt); /* Get current time and date */
printf("The time is %d:%d:%d\n",
      (short)dt.hours,
      (short)dt.minutes,
      (short)dt.seconds);
</code>
 
== Related Functions ==
*[[DosSetDateTime]]


=== OS Version Introduced ===
[[Category:Dos]]
OS/2 1.x

Latest revision as of 11:24, 12 October 2018

DosGetDateTime gets the current date and time.

Syntax

DosGetDateTime ( pdtm )

Parameters

pdtm - PDATETIME - input
Pointer to a DATETIME structure where the date and time information is to be stored.

Returns

This function returns an APIRET with no values.

APIRET  rc
0       NO_ERROR

Define (C/C++)

#define INCL_DOSDATETIME
#include <os2.h>

Export name/Ordinal

DOSCALLS.DLL 230.

Gotchas

The sign of the time zone is opposed to that ordinary used. Ie GMT+1 (Western Europe) <=> -60

Sample Code

PDATETIME  pdtm;
DATETIME   dtm;
APIRET     rc;
...
pdtm = &dtm;
rc = DosGetDateTime (pdtm);
#define INCL_DOSDATETIME 
#include <os2.h> 
#include <stdio.h> /* For printf */ 

DATETIME dt; 
APIRET rc; 

rc=DosGetDateTime(&dt); /* Get current time and date */ 

printf("The time is %d:%d:%d\n", 
      (short)dt.hours, 
      (short)dt.minutes, 
      (short)dt.seconds);

Related Functions