From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thibaut Verron Newsgroups: gmane.emacs.help Subject: Re: Storing hours, minutes, seconds, and nanoseconds from format-time-string Date: Tue, 6 Dec 2022 16:22:01 +0100 Message-ID: <271ed048-4994-b9ac-1e29-e2d7042ab447@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26363"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 To: Heime , Heime via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 06 16:23:01 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2Zmd-0006Yc-Je for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 06 Dec 2022 16:22:59 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2Zlv-0007mI-2b; Tue, 06 Dec 2022 10:22:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2Zlp-0007lm-Gs for help-gnu-emacs@gnu.org; Tue, 06 Dec 2022 10:22:09 -0500 Original-Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p2Zln-0000Bq-RO for help-gnu-emacs@gnu.org; Tue, 06 Dec 2022 10:22:09 -0500 Original-Received: by mail-ej1-x636.google.com with SMTP id x22so6971506ejs.11 for ; Tue, 06 Dec 2022 07:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=T2eIfmASPle4lPscPWlCDIBl62tUvyEUyLIHsF6u1zk=; b=gevOHKhAvEStYVw9YbLeXUsYdIQ9rP8cYK5hVOqFdgLeIAWHKQzdRwu+kcnAbXlIKn J1Y0mavyNZtMrV0PURN88pyFtsUdikuyIYq8vFcfgg7F/nABrsTczFmMUVqVKfLPFLij abL8AiTlCyxPKhEO3AvpGo1sVBSp03swtTGa5VnWfsrrVjeySkDJ9HNBN5NAQtewqe+F x4liY1f8ElVdLdAO2W8FqeF4tj7t3HB2E5Z08N9Hi6oztGVRc1tlhjy+BZWPXEEzHUdt 71SlJPdcZ7djXUqo+GZtvrzyUu0pmTzhXaRTmTr0T123KDBUvEUxYjlj0gZiVAqIYetB 8hzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T2eIfmASPle4lPscPWlCDIBl62tUvyEUyLIHsF6u1zk=; b=NrjkjyP1bzJwy1woQBCO9gcb7X8YuJSpi6xxrFVqcOYKNJ+sSrMnNdhJ9mkTTC2bF1 TMzCiL7tVKv1zLovIpvyHyHd85Txryv5uoIctzmCmUPGY5mwJ3x7dzv5qis9suRgytT/ Fhg9dEtiVX3FTpszxMEl7bs0d5XRL02UZdYfJBj0o8Z0NDrW4wVCY9KlZ3veujw9B1PY fgVAgEwSHHeJKZHfqu25AHec3qh5C6wJ+YpOjHNzhBzbbCKKMKa9YHq9OJfI2nUxD+n8 oJTQEWAR/AV2HGfFXkdkPSFKNmrIRVURlEHFruhRXbQziFXBleCpi2z8I0KXlGAofVSb H50Q== X-Gm-Message-State: ANoB5plzRyl34cWJ9TbmwgSHby0rCHX78qaDk0F/sIZntWChOJRRXq85 Txf6xM5ga2bYcFFU83GM9GSZID8G0ws= X-Google-Smtp-Source: AA0mqf6yBXTvlXdixwSmrazdyCYe8YDtKVhSGsgtZP49qJgO0on6Bql9NdtesqW6rDVHmdJAqWrhug== X-Received: by 2002:a17:906:a082:b0:7bd:1fdf:ac09 with SMTP id q2-20020a170906a08200b007bd1fdfac09mr43736498ejy.287.1670340122914; Tue, 06 Dec 2022 07:22:02 -0800 (PST) Original-Received: from ?IPV6:2001:628:2010:4094:e478:40f3:1e41:76c5? ([2001:628:2010:4094:e478:40f3:1e41:76c5]) by smtp.gmail.com with ESMTPSA id lg17-20020a170906f89100b007c0efbaa724sm2787572ejb.49.2022.12.06.07.22.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Dec 2022 07:22:02 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=thibaut.verron@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.27, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141440 Archived-At: On 06/12/2022 10:23, Heime wrote: > I am getting the time using the format "%FT%T.%N%z". > > (format-time-string "%FT%T.%N%z" nil tzone) > > From the result I need to get the hours, minutes, seconds, > and nanoseconds to store them into four numeric variables. > > How can I do this from the output of "format-time-string". Dear Heime, As others have already pointed out, you might benefit by reading up on the etiquette rules applicable when asking strangers for help on the internet. Things like saying please and thank you, showing minimal effort, expressing the problem clearly... would go a long way in improving the form of your communication, and in turn in getting better and faster answers. This community is very friendly and most cannot say no to an elisp problem, but nobody has unlimited patience. --- You can use format-time-string to directly get the data you want, and then separate it either by using string processing, or by making the output a valid elisp sexp. For example: (split-string (format-time-string "%H %M %S %N")) ;; using string processing (car (read-from-string (format-time-string "(%H %M %S %N)"))) ;; using elisp processing Good luck. Thibaut