From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id D34F66EC40; Mon, 16 Aug 2021 03:20:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D34F66EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1629073254; bh=5MwKoqzD9ZwruBtAxKSt9QxDGmMSAYcxBWbYuKMaeSw=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=G1do7ynKzJCsj7Vkq05b6ulZ8rcqZw2QNc9ROyUc5OMxdX+j3I+9rducbpt7UNTNz zd6VrcPjwsdPIN2dGPH4L5ZPzrEXIFVUFbMAzlimwRWsHkxPlcEbgrNtBAfHZRGoV1 gTwRemfhkVVcJCKaUezW6dLP1aU/8oWY9jSdjzpQ= Received: from smtp41.i.mail.ru (smtp41.i.mail.ru [94.100.177.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E867E6EC40 for ; Mon, 16 Aug 2021 03:20:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E867E6EC40 Received: by smtp41.i.mail.ru with esmtpa (envelope-from ) id 1mFQN1-0008SJ-Tq; Mon, 16 Aug 2021 03:20:52 +0300 To: v.shpilevoy@tarantool.org, imun@tarantool.org, imeevma@tarantool.org, tarantool-patches@dev.tarantool.org References: <5e5afbb7249c1dfa56f2695fc6a7140be98fa39d.1629071531.git.tsafin@tarantool.org> Message-ID: <8bec4ec7-71fa-71cf-dd4a-73ce470c7283@tarantool.org> Date: Mon, 16 Aug 2021 03:20:42 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <5e5afbb7249c1dfa56f2695fc6a7140be98fa39d.1629071531.git.tsafin@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD972FF4A7D76DB5E242D14FEF1BD8BF4AC182A05F538085040D7B671563ABA74EB0DAD780861173A1690350961C4F4AA2F216EF433808AEA16 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE732F68F8AF5E5BA59EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F907CB39E8CA2E228638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D846F17F35DC97FDF7BDC30CE8F52D564F117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC2EE5AD8F952D28FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE7B96B19DC40933217B089FF177BE8049D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE389DDFE3E282F3DD103F1AB874ED89028C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637427B078F297B269AEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458F0AFF96BAACF4158235E5A14AD4A4A4625E192CAD1D9E79D0B18DC6AC13D9A1CDACEBE054328722E X-C1DE0DAB: 0D63561A33F958A54813E98D94BB01A2876CFCE9B07CBFF2BBE3586EA07B56F5D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA752DA3D96DA0CEF5C48E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34EB7BD66E9101C100A521E09E09C79ACBA9688A4257FB165AFB8921B5324F13A55B30E866F2623FDF1D7E09C32AA3244C2CA6126164C0519C6F02BE9504CF5940435BF7150578642F83B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojVT2don9h9Kr2oJTfNN7ANg== X-Mailru-Sender: B5B6A6EBBD94DAD833E4B9A85F720031580E4BAD9C88E1ABF37DFACF8E77E05CFF8E3EDDFAFEBE651EC9E4A2C82A33BC8C24925A86E657CE0C70AEE3C9A96FBAB3D7EE8ED63280BE112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 4/8] box, datetime: messagepack support for datetime X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Safin Timur via Tarantool-patches Reply-To: Safin Timur Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On 16.08.2021 2:59, Timur Safin wrote: > Serialize datetime_t as newly introduced MP_EXT type. > It saves 1 required integer field and upto 2 optional > unsigned fields in very compact fashion. > - secs is required field; > - but nsec, offset are both optional; > > * json, yaml serialization formats, lua output mode > supported; > * exported symbols for datetime messagepack size calculations > so they are available for usage on Lua side. > > Part of #5941 > Part of #5946 ... > diff --git a/src/lib/core/mp_datetime.c b/src/lib/core/mp_datetime.c > new file mode 100644 > index 000000000..d0a3e562c > --- /dev/null > +++ b/src/lib/core/mp_datetime.c ... > + > +int > +mp_snprint_datetime(char *buf, int size, const char **data, uint32_t len) > +{ > + struct datetime date = {0}; Due to old gcc compiler used by CentOS7 I had to modify these 2 functions - see incremental patch below... > + > + if (datetime_unpack(data, len, &date) == NULL) > + return -1; > + > + return datetime_to_string(&date, buf, size); > +} > + > +int > +mp_fprint_datetime(FILE *file, const char **data, uint32_t len) > +{ > + struct datetime date; > + > + if (datetime_unpack(data, len, &date) == NULL) > + return -1; > + > + char buf[48]; > + datetime_to_string(&date, buf, sizeof buf); > + > + return fprintf(file, "%s", buf); > +} > + ---------------------------------------------------------------- 03:15 $ git diff diff --git a/src/lib/core/mp_datetime.c b/src/lib/core/mp_datetime.c index d0a3e562c..7e475d5f1 100644 --- a/src/lib/core/mp_datetime.c +++ b/src/lib/core/mp_datetime.c @@ -165,7 +165,7 @@ mp_encode_datetime(char *data, const struct datetime *date) int mp_snprint_datetime(char *buf, int size, const char **data, uint32_t len) { - struct datetime date = {0}; + struct datetime date = {0, 0, 0}; if (datetime_unpack(data, len, &date) == NULL) return -1; @@ -176,7 +176,7 @@ mp_snprint_datetime(char *buf, int size, const char **data, uint32_t len) int mp_fprint_datetime(FILE *file, const char **data, uint32_t len) { - struct datetime date; + struct datetime date = {0, 0, 0}; if (datetime_unpack(data, len, &date) == NULL) return -1; ---------------------------------------------------------------- Sorry for the inconvenience! [Applied and force pushed] Timur