MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / CurrentDateTime

Method CurrentDateTime

xmpsdk/src/XMPUtils.cpp:1909–1933  ·  view source on GitHub ↗

class static */

Source from the content-addressed store, hash-verified

1907// ---------------
1908
1909/* class static */ void
1910XMPUtils::CurrentDateTime ( XMP_DateTime * xmpTime )
1911{
1912 XMP_Assert ( xmpTime != 0 ); // ! Enforced by wrapper.
1913
1914 ansi_tt binTime = ansi_time(0);
1915 if ( binTime == -1 ) XMP_Throw ( "Failure from ANSI C time function", kXMPErr_ExternalFailure );
1916 ansi_tm currTime;
1917 ansi_localtime ( &binTime, &currTime );
1918
1919 xmpTime->year = currTime.tm_year + 1900;
1920 xmpTime->month = currTime.tm_mon + 1;
1921 xmpTime->day = currTime.tm_mday;
1922 xmpTime->hour = currTime.tm_hour;
1923 xmpTime->minute = currTime.tm_min;
1924 xmpTime->second = currTime.tm_sec;
1925
1926 xmpTime->nanoSecond = 0;
1927 xmpTime->tzSign = 0;
1928 xmpTime->tzHour = 0;
1929 xmpTime->tzMinute = 0;
1930
1931 XMPUtils::SetTimeZone ( xmpTime );
1932
1933} // CurrentDateTime
1934
1935
1936// -------------------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 1

ansi_localtimeFunction · 0.85

Tested by

no test coverage detected