Natools

Check-in [57cb40c5fb]
Login
Overview
Comment:s_expressions-templates-dates: fix incorrect weekday w.r.t. time zone
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 57cb40c5fb4c8113baa3f107cad121b740d05b0e
User & Date: nat on 2015-11-12 18:08:36
Other Links: manifest | tags
Context
2015-11-14
18:12
cron: use non-positive periods to mean non-repeating events check-in: c9ed8bd1e7 user: nat tags: trunk
2015-11-12
18:08
s_expressions-templates-dates: fix incorrect weekday w.r.t. time zone check-in: 57cb40c5fb user: nat tags: trunk
2015-11-11
18:24
s_expressions-templates-tests-dates: new test to show bad interaction between day-of-week and timezone check-in: a279720b94 user: nat tags: trunk
Changes

Modified src/natools-s_expressions-templates-dates.adb from [430a2a1814] to [d0583f55af].

1
2
3
4
5
6
7
8
9
------------------------------------------------------------------------------
-- Copyright (c) 2014, Natacha Porté                                        --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --

|







1
2
3
4
5
6
7
8
9
------------------------------------------------------------------------------
-- Copyright (c) 2014-2015, Natacha Porté                                   --
--                                                                          --
-- Permission to use, copy, modify, and distribute this software for any    --
-- purpose with or without fee is hereby granted, provided that the above   --
-- copyright notice and this permission notice appear in all copies.        --
--                                                                          --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF         --
343
344
345
346
347
348
349




350
351
352
353
354
355
356
   ----------------------

   function Split
     (Value : Ada.Calendar.Time;
      Time_Zone : Ada.Calendar.Time_Zones.Time_Offset)
     return Split_Time
   is




      Year : Ada.Calendar.Year_Number;
      Month : Ada.Calendar.Month_Number;
      Day : Ada.Calendar.Day_Number;
      Hour : Ada.Calendar.Formatting.Hour_Number;
      Minute : Ada.Calendar.Formatting.Minute_Number;
      Second : Ada.Calendar.Formatting.Second_Number;
      Sub_Second : Ada.Calendar.Formatting.Second_Duration;







>
>
>
>







343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
   ----------------------

   function Split
     (Value : Ada.Calendar.Time;
      Time_Zone : Ada.Calendar.Time_Zones.Time_Offset)
     return Split_Time
   is
      use type Ada.Calendar.Time_Zones.Time_Offset;
      Zone_Offset : constant Ada.Calendar.Time_Zones.Time_Offset
        := Time_Zone - Ada.Calendar.Time_Zones.UTC_Time_Offset (Value);

      Year : Ada.Calendar.Year_Number;
      Month : Ada.Calendar.Month_Number;
      Day : Ada.Calendar.Day_Number;
      Hour : Ada.Calendar.Formatting.Hour_Number;
      Minute : Ada.Calendar.Formatting.Minute_Number;
      Second : Ada.Calendar.Formatting.Second_Number;
      Sub_Second : Ada.Calendar.Formatting.Second_Duration;
364
365
366
367
368
369
370
371

372
373
374
375
376
377
378

      return Split_Time'
        (Source => Value,
         Time_Zone => Time_Zone,
         Year => Year,
         Month => Month,
         Day => Day,
         Day_Of_Week => Ada.Calendar.Formatting.Day_Of_Week (Value),

         Hour => Hour,
         Minute => Minute,
         Second => Second,
         Sub_Second => Sub_Second);
   end Split;









|
>







368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383

      return Split_Time'
        (Source => Value,
         Time_Zone => Time_Zone,
         Year => Year,
         Month => Month,
         Day => Day,
         Day_Of_Week => Ada.Calendar.Formatting.Day_Of_Week
           (Ada.Calendar."+" (Value, 60 * Duration (Zone_Offset))),
         Hour => Hour,
         Minute => Minute,
         Second => Second,
         Sub_Second => Sub_Second);
   end Split;