/usr/include/d/gtkd-3/glib/TimeZone.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module glib.TimeZone;
private import glib.ConstructionException;
private import glib.Str;
private import glib.c.functions;
public import glib.c.types;
public import gtkc.glibtypes;
private import gtkd.Loader;
/**
* #GTimeZone is an opaque structure whose members cannot be accessed
* directly.
*
* Since: 2.26
*/
public class TimeZone
{
/** the main Gtk struct */
protected GTimeZone* gTimeZone;
protected bool ownedRef;
/** Get the main Gtk struct */
public GTimeZone* getTimeZoneStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gTimeZone;
}
/** the main Gtk struct as a void* */
protected void* getStruct()
{
return cast(void*)gTimeZone;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GTimeZone* gTimeZone, bool ownedRef = false)
{
this.gTimeZone = gTimeZone;
this.ownedRef = ownedRef;
}
~this ()
{
if ( Linker.isLoaded(LIBRARY_GLIB) && ownedRef )
g_time_zone_unref(gTimeZone);
}
/**
* Creates a #GTimeZone corresponding to @identifier.
*
* @identifier can either be an RFC3339/ISO 8601 time offset or
* something that would pass as a valid value for the `TZ` environment
* variable (including %NULL).
*
* In Windows, @identifier can also be the unlocalized name of a time
* zone for standard time, for example "Pacific Standard Time".
*
* Valid RFC3339 time offsets are `"Z"` (for UTC) or
* `"±hh:mm"`. ISO 8601 additionally specifies
* `"±hhmm"` and `"±hh"`. Offsets are
* time values to be added to Coordinated Universal Time (UTC) to get
* the local time.
*
* In UNIX, the `TZ` environment variable typically corresponds
* to the name of a file in the zoneinfo database, or string in
* "std offset [dst [offset],start[/time],end[/time]]" (POSIX) format.
* There are no spaces in the specification. The name of standard
* and daylight savings time zone must be three or more alphabetic
* characters. Offsets are time values to be added to local time to
* get Coordinated Universal Time (UTC) and should be
* `"[±]hh[[:]mm[:ss]]"`. Dates are either
* `"Jn"` (Julian day with n between 1 and 365, leap
* years not counted), `"n"` (zero-based Julian day
* with n between 0 and 365) or `"Mm.w.d"` (day d
* (0 <= d <= 6) of week w (1 <= w <= 5) of month m (1 <= m <= 12), day
* 0 is a Sunday). Times are in local wall clock time, the default is
* 02:00:00.
*
* In Windows, the "tzn[+|–]hh[:mm[:ss]][dzn]" format is used, but also
* accepts POSIX format. The Windows format uses US rules for all time
* zones; daylight savings time is 60 minutes behind the standard time
* with date and time of change taken from Pacific Standard Time.
* Offsets are time values to be added to the local time to get
* Coordinated Universal Time (UTC).
*
* g_time_zone_new_local() calls this function with the value of the
* `TZ` environment variable. This function itself is independent of
* the value of `TZ`, but if @identifier is %NULL then `/etc/localtime`
* will be consulted to discover the correct time zone on UNIX and the
* registry will be consulted or GetTimeZoneInformation() will be used
* to get the local time zone on Windows.
*
* If intervals are not available, only time zone rules from `TZ`
* environment variable or other means, then they will be computed
* from year 1900 to 2037. If the maximum year for the rules is
* available and it is greater than 2037, then it will followed
* instead.
*
* See
* [RFC3339 §5.6](http://tools.ietf.org/html/rfc3339#section-5.6)
* for a precise definition of valid RFC3339 time offsets
* (the `time-offset` expansion) and ISO 8601 for the
* full list of valid time offsets. See
* [The GNU C Library manual](http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html)
* for an explanation of the possible
* values of the `TZ` environment variable. See
* [Microsoft Time Zone Index Values](http://msdn.microsoft.com/en-us/library/ms912391%28v=winembedded.11%29.aspx)
* for the list of time zones on Windows.
*
* You should release the return value by calling g_time_zone_unref()
* when you are done with it.
*
* Params:
* identifier = a timezone identifier
*
* Returns: the requested timezone
*
* Since: 2.26
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this(string identifier)
{
auto p = g_time_zone_new(Str.toStringz(identifier));
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GTimeZone*) p);
}
/**
* Finds an interval within @tz that corresponds to the given @time_,
* possibly adjusting @time_ if required to fit into an interval.
* The meaning of @time_ depends on @type.
*
* This function is similar to g_time_zone_find_interval(), with the
* difference that it always succeeds (by making the adjustments
* described below).
*
* In any of the cases where g_time_zone_find_interval() succeeds then
* this function returns the same value, without modifying @time_.
*
* This function may, however, modify @time_ in order to deal with
* non-existent times. If the non-existent local @time_ of 02:30 were
* requested on March 14th 2010 in Toronto then this function would
* adjust @time_ to be 03:00 and return the interval containing the
* adjusted time.
*
* Params:
* type = the #GTimeType of @time_
* time = a pointer to a number of seconds since January 1, 1970
*
* Returns: the interval containing @time_, never -1
*
* Since: 2.26
*/
public int adjustTime(GTimeType type, long* time)
{
return g_time_zone_adjust_time(gTimeZone, type, time);
}
/**
* Finds an the interval within @tz that corresponds to the given @time_.
* The meaning of @time_ depends on @type.
*
* If @type is %G_TIME_TYPE_UNIVERSAL then this function will always
* succeed (since universal time is monotonic and continuous).
*
* Otherwise @time_ is treated as local time. The distinction between
* %G_TIME_TYPE_STANDARD and %G_TIME_TYPE_DAYLIGHT is ignored except in
* the case that the given @time_ is ambiguous. In Toronto, for example,
* 01:30 on November 7th 2010 occurred twice (once inside of daylight
* savings time and the next, an hour later, outside of daylight savings
* time). In this case, the different value of @type would result in a
* different interval being returned.
*
* It is still possible for this function to fail. In Toronto, for
* example, 02:00 on March 14th 2010 does not exist (due to the leap
* forward to begin daylight savings time). -1 is returned in that
* case.
*
* Params:
* type = the #GTimeType of @time_
* time = a number of seconds since January 1, 1970
*
* Returns: the interval containing @time_, or -1 in case of failure
*
* Since: 2.26
*/
public int findInterval(GTimeType type, long time)
{
return g_time_zone_find_interval(gTimeZone, type, time);
}
/**
* Determines the time zone abbreviation to be used during a particular
* @interval of time in the time zone @tz.
*
* For example, in Toronto this is currently "EST" during the winter
* months and "EDT" during the summer months when daylight savings time
* is in effect.
*
* Params:
* interval = an interval within the timezone
*
* Returns: the time zone abbreviation, which belongs to @tz
*
* Since: 2.26
*/
public string getAbbreviation(int interval)
{
return Str.toString(g_time_zone_get_abbreviation(gTimeZone, interval));
}
/**
* Determines the offset to UTC in effect during a particular @interval
* of time in the time zone @tz.
*
* The offset is the number of seconds that you add to UTC time to
* arrive at local time for @tz (ie: negative numbers for time zones
* west of GMT, positive numbers for east).
*
* Params:
* interval = an interval within the timezone
*
* Returns: the number of seconds that should be added to UTC to get the
* local time in @tz
*
* Since: 2.26
*/
public int getOffset(int interval)
{
return g_time_zone_get_offset(gTimeZone, interval);
}
/**
* Determines if daylight savings time is in effect during a particular
* @interval of time in the time zone @tz.
*
* Params:
* interval = an interval within the timezone
*
* Returns: %TRUE if daylight savings time is in effect
*
* Since: 2.26
*/
public bool isDst(int interval)
{
return g_time_zone_is_dst(gTimeZone, interval) != 0;
}
/**
* Increases the reference count on @tz.
*
* Returns: a new reference to @tz.
*
* Since: 2.26
*/
public TimeZone doref()
{
auto p = g_time_zone_ref(gTimeZone);
if(p is null)
{
return null;
}
return new TimeZone(cast(GTimeZone*) p, true);
}
/**
* Decreases the reference count on @tz.
*
* Since: 2.26
*/
public void unref()
{
g_time_zone_unref(gTimeZone);
}
}
|