root/source4/smb_server/smb/srvtime.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. srv_push_dos_date
  2. srv_push_dos_date2
  3. srv_push_dos_date3
  4. srv_pull_dos_date
  5. srv_pull_dos_date2
  6. srv_pull_dos_date3

   1 /* 
   2    Unix SMB/CIFS implementation.
   3 
   4    server side time handling
   5 
   6    Copyright (C) Andrew Tridgell 2004
   7 
   8    This program is free software; you can redistribute it and/or modify
   9    it under the terms of the GNU General Public License as published by
  10    the Free Software Foundation; either version 3 of the License, or
  11    (at your option) any later version.
  12    
  13    This program is distributed in the hope that it will be useful,
  14    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16    GNU General Public License for more details.
  17    
  18    You should have received a copy of the GNU General Public License
  19    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  20 */
  21 
  22 #include "includes.h"
  23 #include "smb_server/smb_server.h"
  24 
  25 
  26 /*******************************************************************
  27 put a dos date into a buffer (time/date format)
  28 This takes GMT time and puts local time for zone_offset in the buffer
  29 ********************************************************************/
  30 void srv_push_dos_date(struct smbsrv_connection *smb_server,
     /* [<][>][^][v][top][bottom][index][help] */
  31                       uint8_t *buf, int offset, time_t unixdate)
  32 {
  33         push_dos_date(buf, offset, unixdate, smb_server->negotiate.zone_offset);
  34 }
  35 
  36 /*******************************************************************
  37 put a dos date into a buffer (date/time format)
  38 This takes GMT time and puts local time in the buffer
  39 ********************************************************************/
  40 void srv_push_dos_date2(struct smbsrv_connection *smb_server,
     /* [<][>][^][v][top][bottom][index][help] */
  41                        uint8_t *buf, int offset, time_t unixdate)
  42 {
  43         push_dos_date2(buf, offset, unixdate, smb_server->negotiate.zone_offset);
  44 }
  45 
  46 /*******************************************************************
  47 put a dos 32 bit "unix like" date into a buffer. This routine takes
  48 GMT and converts it to LOCAL time in zone_offset before putting it
  49 ********************************************************************/
  50 void srv_push_dos_date3(struct smbsrv_connection *smb_server,
     /* [<][>][^][v][top][bottom][index][help] */
  51                        uint8_t *buf, int offset, time_t unixdate)
  52 {
  53         push_dos_date3(buf, offset, unixdate, smb_server->negotiate.zone_offset);
  54 }
  55 
  56 /*******************************************************************
  57 convert a dos date
  58 ********************************************************************/
  59 time_t srv_pull_dos_date(struct smbsrv_connection *smb_server, 
     /* [<][>][^][v][top][bottom][index][help] */
  60                          const uint8_t *date_ptr)
  61 {
  62         return pull_dos_date(date_ptr, smb_server->negotiate.zone_offset);
  63 }
  64 
  65 /*******************************************************************
  66 like srv_pull_dos_date() but the words are reversed
  67 ********************************************************************/
  68 time_t srv_pull_dos_date2(struct smbsrv_connection *smb_server, 
     /* [<][>][^][v][top][bottom][index][help] */
  69                           const uint8_t *date_ptr)
  70 {
  71         return pull_dos_date2(date_ptr, smb_server->negotiate.zone_offset);
  72 }
  73 
  74 /*******************************************************************
  75   create a unix GMT date from a dos date in 32 bit "unix like" format
  76   these arrive in server zone, with corresponding DST
  77   ******************************************************************/
  78 time_t srv_pull_dos_date3(struct smbsrv_connection *smb_server,
     /* [<][>][^][v][top][bottom][index][help] */
  79                           const uint8_t *date_ptr)
  80 {
  81         return pull_dos_date3(date_ptr, smb_server->negotiate.zone_offset);
  82 }

/* [<][>][^][v][top][bottom][index][help] */