[PATCH phosphor-host-ipmid 2/2] Add get sel time cmd

Patrick Williams patrick at stwcx.xyz
Wed Oct 21 07:09:43 AEDT 2015


On Tue, Oct 20, 2015 at 02:20:57PM -0500, OpenBMC Patches wrote:
> From: Adriana Kobylak <anoo at us.ibm.com>
> 
> +ipmi_ret_t ipmi_storage_get_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
> +                              ipmi_request_t request, ipmi_response_t response,
> +                              ipmi_data_len_t data_len, ipmi_context_t context)
> +{
> +    time_t currtime;
> +    ipmi_ret_t rc = IPMI_CC_OK;
> +
> +    // Get current time in seconds since jan 1 1970
> +    time(&currtime);
> +
> +    printf("IPMI Handling GET-SEL-TIME\n");
> +
> +    // From the IPMI Spec 2.0, response should be a 32-bit value
> +    *data_len = sizeof(uint32_t);
> +
> +    // Pack the actual response
> +    memcpy(response, &currtime, *data_len);

How do you ensure the proper endianness?

I don't think this is correct anyhow.  currtime is time_t, which is
typically a signed 64 bits now in order to avoid the 2030/ 2100 problem.
You need to convert it into an unsigned 32 bit (and ensure the
endianness is correct).

-- 
Patrick Williams
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20151020/0e8d0f31/attachment-0001.sig>


More information about the openbmc mailing list